Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -184,7 +184,7 @@ def handle_custom_question(question):
|
|
| 184 |
lowest_value = liabilities_by_year.min()
|
| 185 |
return f"The year with the least amount of liabilities was {lowest_year} with ${lowest_value:,.2f}.", None
|
| 186 |
|
| 187 |
-
if "
|
| 188 |
assets = df[df["tlabel"].astype(str).str.contains("total assets", case=False, na=False)]
|
| 189 |
grouped = assets.groupby("quarter")["value"].sum().last("8Q")
|
| 190 |
fig, ax = plt.subplots()
|
|
@@ -335,6 +335,7 @@ def ask_question(history, question):
|
|
| 335 |
"embedding": embedding
|
| 336 |
})
|
| 337 |
time.sleep(2)
|
|
|
|
| 338 |
return history + [(question, custom_response)], custom_image if custom_image else gr.update()
|
| 339 |
|
| 340 |
# === Fallback to generic plot if question mentions plot/graph/chart ===
|
|
@@ -372,6 +373,7 @@ def ask_question(history, question):
|
|
| 372 |
})
|
| 373 |
|
| 374 |
time.sleep(2)
|
|
|
|
| 375 |
return history + [(question, answer)], gr.update()
|
| 376 |
|
| 377 |
except Exception as e:
|
|
|
|
| 184 |
lowest_value = liabilities_by_year.min()
|
| 185 |
return f"The year with the least amount of liabilities was {lowest_year} with ${lowest_value:,.2f}.", None
|
| 186 |
|
| 187 |
+
if "asset" in q and ("graph" in q or "plot" in q or "chart" in q)::
|
| 188 |
assets = df[df["tlabel"].astype(str).str.contains("total assets", case=False, na=False)]
|
| 189 |
grouped = assets.groupby("quarter")["value"].sum().last("8Q")
|
| 190 |
fig, ax = plt.subplots()
|
|
|
|
| 335 |
"embedding": embedding
|
| 336 |
})
|
| 337 |
time.sleep(2)
|
| 338 |
+
print("Current prompt history:", prompt_history)
|
| 339 |
return history + [(question, custom_response)], custom_image if custom_image else gr.update()
|
| 340 |
|
| 341 |
# === Fallback to generic plot if question mentions plot/graph/chart ===
|
|
|
|
| 373 |
})
|
| 374 |
|
| 375 |
time.sleep(2)
|
| 376 |
+
print("Current prompt history:", prompt_history)
|
| 377 |
return history + [(question, answer)], gr.update()
|
| 378 |
|
| 379 |
except Exception as e:
|