aneesqumar commited on
Commit
8407aa8
·
verified ·
1 Parent(s): f02d489

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -1
app.py CHANGED
@@ -190,13 +190,49 @@ Medication: {d['medication']}
190
  d["factors"]
191
  )
192
 
193
- formatted = last_llm_report.replace("\n", "<br>")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
 
195
  return basic_html + f"""
196
  <hr>
197
  <h3 style="color:#003366;">Detailed AI Report & Recommendations</h3>
198
  <div style="background:#f9f9f9;padding:15px;border-radius:8px;">
199
  {formatted}
 
200
  </div>
201
  """
202
 
 
190
  d["factors"]
191
  )
192
 
193
+ lines = last_llm_report.split("\n")
194
+
195
+ formatted_parts = []
196
+ disclaimer_html = ""
197
+
198
+ for line in lines:
199
+ line = line.strip()
200
+ if not line:
201
+ continue
202
+
203
+ # Detect disclaimer line
204
+ if "consult a qualified doctor" in line.lower():
205
+ disclaimer_html = f"""
206
+ <div style="
207
+ margin-top:15px;
208
+ padding:12px;
209
+ background:#fff3cd;
210
+ border-left:5px solid #ff9800;
211
+ border-radius:6px;
212
+ font-size:14px;">
213
+ <b>Disclaimer:</b><br>
214
+ {line}
215
+ </div>
216
+ """
217
+ continue
218
+
219
+ # Detect headings starting with ##
220
+ if line.startswith("##"):
221
+ clean_heading = line.replace("##", "").strip()
222
+ formatted_parts.append(
223
+ f"<br><b style='font-size:16px;color:#003366;'>{clean_heading}:</b><br>"
224
+ )
225
+ else:
226
+ formatted_parts.append(f"{line}<br>")
227
+
228
+ formatted = "".join(formatted_parts)
229
 
230
  return basic_html + f"""
231
  <hr>
232
  <h3 style="color:#003366;">Detailed AI Report & Recommendations</h3>
233
  <div style="background:#f9f9f9;padding:15px;border-radius:8px;">
234
  {formatted}
235
+ {disclaimer_html}
236
  </div>
237
  """
238