Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -111,12 +111,12 @@ def home():
|
|
111 |
|
112 |
@app.post("/query")
|
113 |
def respond(query: QueryRequest):
|
114 |
-
# Invoke the chain with the question
|
115 |
question = query.question
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
111 |
|
112 |
@app.post("/query")
|
113 |
def respond(query: QueryRequest):
|
|
|
114 |
question = query.question
|
115 |
+
try:
|
116 |
+
result = qa_chain.invoke({"input": question})
|
117 |
+
return {"answer": result['answer']}
|
118 |
+
except Exception as e:
|
119 |
+
# Log the exception in detail
|
120 |
+
import traceback
|
121 |
+
traceback.print_exc()
|
122 |
+
return {"error": str(e)}
|