Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,26 +7,20 @@ from llama_index import GPTVectorStoreIndex
|
|
7 |
openai_api_key = os.getenv('OPENAI_API_KEY')
|
8 |
|
9 |
|
10 |
-
|
11 |
|
12 |
def __call__(
|
13 |
self, inp: str, history: str, chain
|
14 |
):
|
15 |
-
|
|
|
16 |
output = chain({"question": inp, "chat_history": history})["answer"]
|
17 |
history.append((inp, output))
|
18 |
-
return history
|
19 |
-
|
20 |
|
21 |
-
"""
|
22 |
chat = ChatWrapper()
|
23 |
chatbot = gr.Chatbot()
|
24 |
|
25 |
-
def get_response(message):
|
26 |
-
response = (f"You entered: {message}")
|
27 |
-
return response
|
28 |
-
|
29 |
-
|
30 |
block = gr.Blocks(css=".gradio-container {background-color: lightblue}")
|
31 |
|
32 |
with block:
|
|
|
7 |
openai_api_key = os.getenv('OPENAI_API_KEY')
|
8 |
|
9 |
|
10 |
+
class ChatWrapper:
|
11 |
|
12 |
def __call__(
|
13 |
self, inp: str, history: str, chain
|
14 |
):
|
15 |
+
|
16 |
+
# Execute the chat functionality.
|
17 |
output = chain({"question": inp, "chat_history": history})["answer"]
|
18 |
history.append((inp, output))
|
19 |
+
return history
|
|
|
20 |
|
|
|
21 |
chat = ChatWrapper()
|
22 |
chatbot = gr.Chatbot()
|
23 |
|
|
|
|
|
|
|
|
|
|
|
24 |
block = gr.Blocks(css=".gradio-container {background-color: lightblue}")
|
25 |
|
26 |
with block:
|