Update app.py
Browse files
app.py
CHANGED
|
@@ -380,6 +380,8 @@ def generate_pdf(*inputs):
|
|
| 380 |
elements.append(Spacer(1,0.4*inch))
|
| 381 |
|
| 382 |
# ---- DETAILED AI REPORT (Formatted with Headings + Bullets) ----
|
|
|
|
|
|
|
| 383 |
if last_llm_report:
|
| 384 |
elements.append(Paragraph("<b>Detailed AI Report</b>", heading_style))
|
| 385 |
elements.append(Spacer(1,0.2*inch))
|
|
@@ -388,17 +390,26 @@ def generate_pdf(*inputs):
|
|
| 388 |
|
| 389 |
for line in lines:
|
| 390 |
line = line.strip()
|
|
|
|
| 391 |
if not line:
|
| 392 |
continue
|
| 393 |
|
| 394 |
-
#
|
| 395 |
-
if line.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 396 |
elements.append(Spacer(1,0.2*inch))
|
| 397 |
-
elements.append(
|
|
|
|
|
|
|
| 398 |
else:
|
|
|
|
| 399 |
elements.append(Paragraph(f"• {line}", bullet_style))
|
| 400 |
|
| 401 |
-
|
| 402 |
|
| 403 |
# ---- DISCLAIMER ----
|
| 404 |
elements.append(Paragraph("Disclaimer", disclaimer_heading_style))
|
|
|
|
| 380 |
elements.append(Spacer(1,0.4*inch))
|
| 381 |
|
| 382 |
# ---- DETAILED AI REPORT (Formatted with Headings + Bullets) ----
|
| 383 |
+
# ---- DETAILED AI REPORT (Formatted with ## Headings) ----
|
| 384 |
+
|
| 385 |
if last_llm_report:
|
| 386 |
elements.append(Paragraph("<b>Detailed AI Report</b>", heading_style))
|
| 387 |
elements.append(Spacer(1,0.2*inch))
|
|
|
|
| 390 |
|
| 391 |
for line in lines:
|
| 392 |
line = line.strip()
|
| 393 |
+
|
| 394 |
if not line:
|
| 395 |
continue
|
| 396 |
|
| 397 |
+
# ❌ Remove disclaimer coming from LLM
|
| 398 |
+
if "consult a qualified doctor" in line.lower():
|
| 399 |
+
continue
|
| 400 |
+
|
| 401 |
+
# ✅ Detect headings starting with ##
|
| 402 |
+
if line.startswith("##"):
|
| 403 |
+
clean_heading = line.replace("##", "").strip()
|
| 404 |
elements.append(Spacer(1,0.2*inch))
|
| 405 |
+
elements.append(
|
| 406 |
+
Paragraph(f"<b>{clean_heading}:</b>", heading_style)
|
| 407 |
+
)
|
| 408 |
else:
|
| 409 |
+
#elements.append(Paragraph(line, styles["Normal"]))
|
| 410 |
elements.append(Paragraph(f"• {line}", bullet_style))
|
| 411 |
|
| 412 |
+
elements.append(Spacer(1,0.5*inch))
|
| 413 |
|
| 414 |
# ---- DISCLAIMER ----
|
| 415 |
elements.append(Paragraph("Disclaimer", disclaimer_heading_style))
|