victor7246 commited on
Commit
79ec2bb
·
verified ·
1 Parent(s): a837b64

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -152,17 +152,13 @@ if __name__ == '__main__':
152
  print (top_table_names)
153
  #history = st.session_state['questions']
154
  history = st.session_state['history']
155
- try:
156
- db_chain._call(inputs={'query': question, 'history': history, \
157
  'table_names_to_use': top_table_names})
158
- except:
159
- pass
160
-
161
- if db_chain.intermediate_steps.get("sql_cmd_unchecked",'') == '':
162
- #print (db_chain)
163
- #st.markdown("Sorry I cannot answer that. Please try again later.")
164
- response = "Sorry I may not have answer to this question."
165
- elif db_chain.intermediate_steps.get("result",'') != '':
166
  #st.markdown("Answer to your question is - " + db_chain.intermediate_steps.get("result",''))
167
  #print (db_chain.intermediate_steps.get("result",''))
168
  #st.markdown("The SQL query is - " + db_chain.intermediate_steps['sql_cmd'])
@@ -173,6 +169,10 @@ if __name__ == '__main__':
173
  #st.table(out)
174
  #st.markdown("The SQL query is - " + db_chain.intermediate_steps['sql_cmd'])
175
  response = tabulate(out, headers='keys', tablefmt='psql')
 
 
 
 
176
  else:
177
  #st.markdown("Sorry I cannot answer that. Please try again later.")
178
  response = "Sorry I may not have answer to this question."
 
152
  print (top_table_names)
153
  #history = st.session_state['questions']
154
  history = st.session_state['history']
155
+ #try:
156
+ db_chain._call(inputs={'query': question, 'history': history, \
157
  'table_names_to_use': top_table_names})
158
+ #except:
159
+ # pass
160
+
161
+ if db_chain.intermediate_steps.get("result",'') != '':
 
 
 
 
162
  #st.markdown("Answer to your question is - " + db_chain.intermediate_steps.get("result",''))
163
  #print (db_chain.intermediate_steps.get("result",''))
164
  #st.markdown("The SQL query is - " + db_chain.intermediate_steps['sql_cmd'])
 
169
  #st.table(out)
170
  #st.markdown("The SQL query is - " + db_chain.intermediate_steps['sql_cmd'])
171
  response = tabulate(out, headers='keys', tablefmt='psql')
172
+ elif db_chain.intermediate_steps.get("sql_cmd_unchecked",'') == '':
173
+ #print (db_chain)
174
+ #st.markdown("Sorry I cannot answer that. Please try again later.")
175
+ response = "Sorry I may not have answer to this question."
176
  else:
177
  #st.markdown("Sorry I cannot answer that. Please try again later.")
178
  response = "Sorry I may not have answer to this question."