Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,12 @@
|
|
1 |
# Import dependencies
|
2 |
import gradio as gr
|
3 |
-
|
4 |
from llama_index import GPTVectorStoreIndex
|
5 |
-
from langchain.prompts.prompt import PromptTemplate
|
6 |
-
from langchain.llms import OpenAI
|
7 |
-
from langchain.chains import ChatVectorDBChain
|
8 |
from query_data import get_chain
|
9 |
-
from response import get_response"""
|
10 |
-
|
11 |
|
12 |
|
13 |
# Execute the chat functionality.
|
14 |
-
|
15 |
-
# history.append((inp, output))
|
16 |
-
# return history
|
17 |
|
18 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
19 |
|
@@ -29,7 +22,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
29 |
response = gr.Textbox
|
30 |
|
31 |
def respond(message, chat_history):
|
32 |
-
response =
|
33 |
chat_history.append((message, response))
|
34 |
return "", chat_history
|
35 |
|
@@ -42,7 +35,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
42 |
"I feel lonely",
|
43 |
"I'm having problems at home",
|
44 |
"I am looking for some resources",
|
45 |
-
]
|
46 |
inputs=message
|
47 |
)
|
48 |
|
|
|
1 |
# Import dependencies
|
2 |
import gradio as gr
|
3 |
+
import os
|
4 |
from llama_index import GPTVectorStoreIndex
|
|
|
|
|
|
|
5 |
from query_data import get_chain
|
|
|
|
|
6 |
|
7 |
|
8 |
# Execute the chat functionality.
|
9 |
+
output = chain({"message": inp, "chat_history": history})["response"]
|
|
|
|
|
10 |
|
11 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
12 |
|
|
|
22 |
response = gr.Textbox
|
23 |
|
24 |
def respond(message, chat_history):
|
25 |
+
response = output
|
26 |
chat_history.append((message, response))
|
27 |
return "", chat_history
|
28 |
|
|
|
35 |
"I feel lonely",
|
36 |
"I'm having problems at home",
|
37 |
"I am looking for some resources",
|
38 |
+
],
|
39 |
inputs=message
|
40 |
)
|
41 |
|