umair894's picture
Create app.py
40b11ef verified
raw
history blame
673 Bytes
import gradio as gr
from langchain.agents.openai_assistant import OpenAIAssistantRunnable
from openai import OpenAI
import os
#sk
apikey = os.getenv('openAI') #key from client
agentkey = os.getenv('asst')
os.environ["OPENAI_API_KEY"] =
interpreter_assistant = OpenAIAssistantRunnable(assistant_id=) #, client = key
# output = interpreter_assistant.invoke({"content": "Hello?"})
# output[0].content[0].text.value
def chat_response(message, history):
output = interpreter_assistant.invoke({"content": message})
response = output[0].content[0].text.value
return response
with gr.Blocks() as demo:
chatbot = gr.ChatInterface(chat_response)
demo.launch(share=True)