Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,12 +86,14 @@ def plot_chart():
|
|
| 86 |
db_chain = get_db_chain()
|
| 87 |
json_chain = get_json_chain()
|
| 88 |
|
| 89 |
-
|
| 90 |
def from_gpt(query: str, plot: bool):
|
| 91 |
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
# Save data as json if plot
|
| 97 |
st.session_state[JSON_DATA_LABEL] = ans if plot else {}
|
|
|
|
| 86 |
db_chain = get_db_chain()
|
| 87 |
json_chain = get_json_chain()
|
| 88 |
|
|
|
|
| 89 |
def from_gpt(query: str, plot: bool):
|
| 90 |
|
| 91 |
+
try:
|
| 92 |
+
chains = [db_chain, json_chain] if plot else [db_chain]
|
| 93 |
+
main_chain = SimpleSequentialChain(chains=chains, verbose=True)
|
| 94 |
+
ans = main_chain.run(query)
|
| 95 |
+
except Exception e:
|
| 96 |
+
return "Sorry, I didn't get that"
|
| 97 |
|
| 98 |
# Save data as json if plot
|
| 99 |
st.session_state[JSON_DATA_LABEL] = ans if plot else {}
|