umair894 commited on
Commit
03cd7c2
·
verified ·
1 Parent(s): 360bbfb

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain.agents.openai_assistant import OpenAIAssistantRunnable
2
+ import os
3
+
4
+ asst_id = os.getenv('assistant_key')
5
+ key = os.getenv('open_ai')
6
+
7
+ interpreter_assistant = OpenAIAssistantRunnable(assistant_id=asst_id, api_key = key)
8
+ import gradio as gr
9
+
10
+ def chat_response(message, history):
11
+ output = interpreter_assistant.invoke({"content": message})
12
+ response = output[0].content[0].text.value
13
+ return response
14
+
15
+ with gr.Blocks() as demo:
16
+ chatbot = gr.ChatInterface(chat_response)
17
+
18
+ demo.launch(share=True)