SuriRaja commited on
Commit
db330ad
·
verified ·
1 Parent(s): bba64cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -13
app.py CHANGED
@@ -114,18 +114,13 @@ def app():
114
  summary_text = "<li>Your hemoglobin is a bit low...</li><li>Consider iron tests.</li>" # Placeholder
115
  pdf_path = generate_pdf_report(image, results_dict, summary_text)
116
 
117
- table_html = """
118
  <table style='width:100%;border-collapse:collapse;margin-top:10px;'>
119
- <tr><th style='border:1px solid #ccc;padding:6px;'>Test</th><th style='border:1px solid #ccc;padding:6px;'>Result</th><th style='border:1px solid #ccc;padding:6px;'>Status</th></tr>"""
120
- for k, v in results_dict.items():
121
- if k in ["Hemoglobin", "WBC Count", "Platelets"]:
122
- status, icon, bg = get_risk_color(v, (13.5, 17.5) if k == "Hemoglobin" else (4.0, 11.0) if k == "WBC Count" else (150, 450))
123
- table_html += f"<tr style='background:{bg}'><td style='border:1px solid #ccc;padding:6px;'>{k}</td><td style='border:1px solid #ccc;padding:6px;'>{v}</td><td style='border:1px solid #ccc;padding:6px;'>{icon} {status}</td></tr>"
124
- else:
125
- table_html += f"<tr><td style='border:1px solid #ccc;padding:6px;'>{k}</td><td style='border:1px solid #ccc;padding:6px;'>{v}</td><td style='border:1px solid #ccc;padding:6px;'>-</td></tr>"
126
- table_html += "</table>"
127
-
128
- summary_block = """
129
  <div style='margin-top:20px;padding:12px;border:1px dashed #999;background:#f9f9f9;'>
130
  <h4>📝 Summary in Your Language</h4>
131
  <details><summary><b>Hindi</b></summary>
@@ -134,13 +129,14 @@ def app():
134
  <details><summary><b>Telugu</b></summary>
135
  <ul><li>మీ హిమోగ్లోబిన్ తక్కువగా ఉంది — ఇది అనీమియా సూచించవచ్చు. CBC, Iron పరీక్షలు చేయించండి.</li></ul>
136
  </details>
137
- </div>"""
 
138
  <details><summary><b>Telugu</b></summary>
139
  <ul><li>మీ హిమోగ్లోబిన్ తక్కువగా ఉంది — ఇది అనీమియా సూచించవచ్చు. CBC, Iron పరీక్షలు చేయించండి.</li></ul>
140
  </details>
141
  </div>"""
142
 
143
- full_html = table_html + summary_block
144
  return full_html, frame_rgb, pdf_path
145
 
146
  with gr.Blocks() as demo:
 
114
  summary_text = "<li>Your hemoglobin is a bit low...</li><li>Consider iron tests.</li>" # Placeholder
115
  pdf_path = generate_pdf_report(image, results_dict, summary_text)
116
 
117
+ table_html = """
118
  <table style='width:100%;border-collapse:collapse;margin-top:10px;'>
119
+ <tr><th colspan='3' style='background:#ddd;text-align:left;padding:6px;'>🩸 Hematology</th></tr>
120
+ <tr><th style='border:1px solid #ccc;padding:6px;'>Test</th><th style='border:1px solid #ccc;padding:6px;'>Result</th><th style='border:1px solid #ccc;padding:6px;'>Level</th></tr>
121
+ """
122
+
123
+ summary_block = """
 
 
 
 
 
124
  <div style='margin-top:20px;padding:12px;border:1px dashed #999;background:#f9f9f9;'>
125
  <h4>📝 Summary in Your Language</h4>
126
  <details><summary><b>Hindi</b></summary>
 
129
  <details><summary><b>Telugu</b></summary>
130
  <ul><li>మీ హిమోగ్లోబిన్ తక్కువగా ఉంది — ఇది అనీమియా సూచించవచ్చు. CBC, Iron పరీక్షలు చేయించండి.</li></ul>
131
  </details>
132
+ </div>
133
+ """
134
  <details><summary><b>Telugu</b></summary>
135
  <ul><li>మీ హిమోగ్లోబిన్ తక్కువగా ఉంది — ఇది అనీమియా సూచించవచ్చు. CBC, Iron పరీక్షలు చేయించండి.</li></ul>
136
  </details>
137
  </div>"""
138
 
139
+ full_html = table_html + summary_block
140
  return full_html, frame_rgb, pdf_path
141
 
142
  with gr.Blocks() as demo: