Spaces:
Runtime error
Runtime error
File size: 620 Bytes
886d623 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
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)
|