Sadiksmart0 commited on
Commit
6ab9d24
·
verified ·
1 Parent(s): a48fb44

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
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
- result = qa_chain.invoke({"input":question})
117
-
118
- # Return the answer
119
- return {"answer": result['answer']}
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)}