Update app.py
Browse files
app.py
CHANGED
|
@@ -443,38 +443,6 @@ def escape_markdown(text):
|
|
| 443 |
return re.sub(escape_chars, r"\\\1", text)
|
| 444 |
|
| 445 |
|
| 446 |
-
# Functions with Progress Bar Updates
|
| 447 |
-
def generate_report():
|
| 448 |
-
try:
|
| 449 |
-
progress_bar.progress(20, text="π Generating Analysis Report...")
|
| 450 |
-
report_inputs = {"query": query + " Provide detailed analysis but DO NOT include Conclusion."}
|
| 451 |
-
|
| 452 |
-
# Attempt to generate the report
|
| 453 |
-
result_container['report'] = crew_report.kickoff(inputs=report_inputs)
|
| 454 |
-
|
| 455 |
-
if not result_container['report']:
|
| 456 |
-
st.warning("β οΈ Report generation failed. No data returned.")
|
| 457 |
-
else:
|
| 458 |
-
progress_bar.progress(40, text="β
Analysis Report Ready!")
|
| 459 |
-
|
| 460 |
-
except Exception as e:
|
| 461 |
-
# Show the exact error message
|
| 462 |
-
st.error(f"β Report generation error: {str(e)}")
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
def generate_conclusion(query, crew_conclusion, result_container, progress_bar, step):
|
| 467 |
-
progress_bar.progress(step, text="π Crafting Conclusion...")
|
| 468 |
-
conclusion_inputs = {"query": query + " Provide ONLY the most important insights in 3-5 concise lines."}
|
| 469 |
-
result_container['conclusion'] = crew_conclusion.kickoff(inputs=conclusion_inputs)
|
| 470 |
-
progress_bar.progress(step + 1, text="β
Conclusion Ready!")
|
| 471 |
-
|
| 472 |
-
def generate_visuals(query, df, llm, result_container, progress_bar, step):
|
| 473 |
-
progress_bar.progress(step, text="π Creating Visualizations...")
|
| 474 |
-
result_container['visuals'] = ask_gpt4o_for_visualization(query, df, llm)
|
| 475 |
-
progress_bar.progress(step + 1, text="β
Visualizations Ready!")
|
| 476 |
-
|
| 477 |
-
|
| 478 |
# SQL-RAG Analysis
|
| 479 |
if st.session_state.df is not None:
|
| 480 |
temp_dir = tempfile.TemporaryDirectory()
|
|
|
|
| 443 |
return re.sub(escape_chars, r"\\\1", text)
|
| 444 |
|
| 445 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 446 |
# SQL-RAG Analysis
|
| 447 |
if st.session_state.df is not None:
|
| 448 |
temp_dir = tempfile.TemporaryDirectory()
|