Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import sqlite3
|
|
| 4 |
import tempfile
|
| 5 |
from fpdf import FPDF
|
| 6 |
import os
|
|
|
|
| 7 |
import json
|
| 8 |
from pathlib import Path
|
| 9 |
import plotly.express as px
|
|
@@ -169,6 +170,10 @@ def create_pdf_report_with_viz(report, conclusion, visualizations):
|
|
| 169 |
return temp_pdf
|
| 170 |
|
| 171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
|
| 173 |
# SQL-RAG Analysis
|
| 174 |
if st.session_state.df is not None:
|
|
@@ -319,7 +324,11 @@ if st.session_state.df is not None:
|
|
| 319 |
|
| 320 |
# Step 6: Display Concise Conclusion
|
| 321 |
#st.markdown("#### Conclusion")
|
| 322 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 323 |
|
| 324 |
# Full Data Visualization Tab
|
| 325 |
with tab2:
|
|
|
|
| 4 |
import tempfile
|
| 5 |
from fpdf import FPDF
|
| 6 |
import os
|
| 7 |
+
import re
|
| 8 |
import json
|
| 9 |
from pathlib import Path
|
| 10 |
import plotly.express as px
|
|
|
|
| 170 |
return temp_pdf
|
| 171 |
|
| 172 |
|
| 173 |
+
def escape_markdown(text):
|
| 174 |
+
# Escape special markdown characters
|
| 175 |
+
escape_chars = r"\*`_{}[]()#+-.!"
|
| 176 |
+
return re.sub(f'([{re.escape(escape_chars)}])', r'\\\1', text)
|
| 177 |
|
| 178 |
# SQL-RAG Analysis
|
| 179 |
if st.session_state.df is not None:
|
|
|
|
| 324 |
|
| 325 |
# Step 6: Display Concise Conclusion
|
| 326 |
#st.markdown("#### Conclusion")
|
| 327 |
+
if conclusion_result:
|
| 328 |
+
safe_conclusion = escape_markdown(conclusion_result)
|
| 329 |
+
st.markdown(f"### π Conclusion\n\n{safe_conclusion}")
|
| 330 |
+
else:
|
| 331 |
+
st.warning("β οΈ No Conclusion Generated.")
|
| 332 |
|
| 333 |
# Full Data Visualization Tab
|
| 334 |
with tab2:
|