Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -93,5 +93,30 @@ if __name__ == '__main__':
|
|
| 93 |
st.markdown("The SQL query is - " + db_chain.intermediate_steps['sql_cmd'])
|
| 94 |
else:
|
| 95 |
st.markdown("Sorry I cannot answer that. Please try again later.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
else:
|
| 97 |
st.markdown("Your question is a generic one. This feature is under development. Please try again later.")
|
|
|
|
| 93 |
st.markdown("The SQL query is - " + db_chain.intermediate_steps['sql_cmd'])
|
| 94 |
else:
|
| 95 |
st.markdown("Sorry I cannot answer that. Please try again later.")
|
| 96 |
+
|
| 97 |
+
feedback = st.radio("Does this answer your question?", ["Yes","No"])
|
| 98 |
+
if feedback == 'No':
|
| 99 |
+
with st.status("Retrieving results again..."):
|
| 100 |
+
top_table_names = table_search(question, topk=1)['table'].tolist()
|
| 101 |
+
print (top_table_names)
|
| 102 |
+
try:
|
| 103 |
+
db_chain._call(inputs={'query': question, 'history': []})
|
| 104 |
+
except:
|
| 105 |
+
pass
|
| 106 |
+
|
| 107 |
+
if db_chain.intermediate_steps.get("sql_cmd_unchecked",'') == '':
|
| 108 |
+
print (db_chain)
|
| 109 |
+
st.markdown("Sorry I cannot answer that. Please try again later.")
|
| 110 |
+
elif db_chain.intermediate_steps.get("result",'') != '':
|
| 111 |
+
st.markdown("Answer to your question is - " + db_chain.intermediate_steps.get("result",''))
|
| 112 |
+
print (db_chain.intermediate_steps.get("result",''))
|
| 113 |
+
st.markdown("The SQL query is - " + db_chain.intermediate_steps['sql_cmd'])
|
| 114 |
+
elif db_chain.intermediate_steps.get("sql_data",'') != '':
|
| 115 |
+
out = pd.DataFrame.from_dict(db_chain.intermediate_steps['sql_data'])
|
| 116 |
+
st.markdown("Here is your result in a table format")
|
| 117 |
+
st.table(out)
|
| 118 |
+
st.markdown("The SQL query is - " + db_chain.intermediate_steps['sql_cmd'])
|
| 119 |
+
else:
|
| 120 |
+
st.markdown("Sorry I cannot answer that. Please try again later.")
|
| 121 |
else:
|
| 122 |
st.markdown("Your question is a generic one. This feature is under development. Please try again later.")
|