Spaces:
Runtime error
Runtime error
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) | |