Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -75,10 +75,14 @@ def ask_ai(question,openai_api_key):
|
|
| 75 |
else:
|
| 76 |
os.environ["OPENAI_API_KEY"] = openai_api_key
|
| 77 |
construct_index("data")
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
|
| 84 |
api_key = gr.inputs.Textbox(label="Paste OPENAI API Key (Or left it blank to use default api)")
|
|
|
|
| 75 |
else:
|
| 76 |
os.environ["OPENAI_API_KEY"] = openai_api_key
|
| 77 |
construct_index("data")
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
reply = chat.choices[0].message.content
|
| 81 |
+
messages.append({"role": "assistant", "content": reply})
|
| 82 |
+
return messages
|
| 83 |
+
#index = GPTSimpleVectorIndex.load_from_disk('index.json')
|
| 84 |
+
#response = index.query(question, response_mode="compact")
|
| 85 |
+
#return response.response
|
| 86 |
|
| 87 |
|
| 88 |
api_key = gr.inputs.Textbox(label="Paste OPENAI API Key (Or left it blank to use default api)")
|