suriya7 commited on
Commit
24092b8
1 Parent(s): d9fe939

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -58,15 +58,16 @@ def handle_query(query):
58
  )
59
  ]
60
  text_qa_template = ChatPromptTemplate.from_messages(chat_text_qa_msgs)
61
- query_engine = index.as_query_engine(text_qa_template=text_qa_template)
62
- answer = query_engine.query(query)
63
-
64
- if hasattr(answer, 'response'):
65
- return answer.response
66
- elif isinstance(answer, dict) and 'response' in answer:
67
- return answer['response']
68
- else:
69
- return "Sorry, I couldn't find an answer."
 
70
 
71
 
72
  # Streamlit app initialization
 
58
  )
59
  ]
60
  text_qa_template = ChatPromptTemplate.from_messages(chat_text_qa_msgs)
61
+ with st.spinner("Thinking..."):
62
+ query_engine = index.as_query_engine(text_qa_template=text_qa_template)
63
+ answer = query_engine.query(query)
64
+
65
+ if hasattr(answer, 'response'):
66
+ return answer.response
67
+ elif isinstance(answer, dict) and 'response' in answer:
68
+ return answer['response']
69
+ else:
70
+ return "Sorry, I couldn't find an answer."
71
 
72
 
73
  # Streamlit app initialization