Langchain_Simple_Gradio_App / langchain-app.py
sushantgo's picture
Upload folder using huggingface_hub
693fd18
raw
history blame contribute delete
620 Bytes
import os
import gradio as gr
from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv())
from langchain.chains import ConversationChain
from langchain.chat_models import ChatOpenAI
from langchain.memory import ConversationBufferMemory
llm = ChatOpenAI(temperature=0.0)
memory = ConversationBufferMemory()
conversion = ConversationChain(
llm=llm,
memory=memory,
verbose=False
)
def takeinput(name):
output_str = conversion.predict(input=name)
return output_str
demo = gr.Interface(
fn=takeinput,
inputs=["text"],
outputs=["text"]
)
demo.launch(share=True)