SuriRaja commited on
Commit
ace77f4
·
verified ·
1 Parent(s): 9905bc8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -0
app.py CHANGED
@@ -128,6 +128,50 @@ def analyze_face(image):
128
  build_table("🩹 Other Indicators", [("Cortisol", cortisol, (5, 25)), ("Albumin", albumin, (3.5, 5.5))])
129
  ])
130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  return html_output, frame_rgb
132
 
133
  with gr.Blocks() as demo:
 
128
  build_table("🩹 Other Indicators", [("Cortisol", cortisol, (5, 25)), ("Albumin", albumin, (3.5, 5.5))])
129
  ])
130
 
131
+ summary = "<div style='margin-top:20px;padding:12px;border:1px dashed #999;background:#fcfcfc;'>"
132
+ summary += "<h4>📝 Summary for You</h4><ul>"
133
+ if hb < 13.5:
134
+ summary += "<li>Your hemoglobin is a bit low — this could mean mild anemia. Consider a CBC test and iron supplements.</li>"
135
+ if iron < 60 or ferritin < 30:
136
+ summary += "<li>Signs of low iron storage detected. An iron profile blood test is recommended.</li>"
137
+ if bilirubin > 1.2:
138
+ summary += "<li>Some signs of jaundice were detected. Please consult for a Liver Function Test (LFT).</li>"
139
+ if hba1c > 5.7:
140
+ summary += "<li>Your HbA1c is slightly elevated — this can signal pre-diabetes. A fasting glucose test may help.</li>"
141
+ if spo2 < 95:
142
+ summary += "<li>Oxygen levels appear below normal. Please recheck with a pulse oximeter if symptoms persist.</li>"
143
+ summary += "</ul><p><strong>💡 Tip:</strong> This is an AI-based screening and should be followed up with a lab visit for confirmation.</p></div>"
144
+
145
+ html_output += summary
146
+
147
+ html_output += "<br><div style='margin-top:20px;padding:12px;border:2px solid #2d87f0;background:#f2faff;text-align:center;border-radius:8px;'>"
148
+ html_output += "<h4>📞 Book a Lab Test</h4>"
149
+ html_output += "<p>Prefer to get your tests confirmed at a nearby center? Click below to find certified labs in your area.</p>"
150
+ html_output += "<button style='padding:10px 20px;background:#007BFF;color:#fff;border:none;border-radius:5px;cursor:pointer;'>Find Labs Near Me</button>"
151
+ html_output += "</div>"
152
+
153
+ lang_blocks = """
154
+ <div style='margin-top:20px;padding:12px;border:1px dashed #999;background:#f9f9f9;'>
155
+ <h4>🗣️ Summary in Your Language</h4>
156
+ <details><summary><b>Hindi</b></summary><ul>
157
+ <li>आपका हीमोग्लोबिन थोड़ा कम है — यह हल्के एनीमिया का संकेत हो सकता है। कृपया CBC और आयरन टेस्ट करवाएं।</li>
158
+ <li>लो आयरन स्टोरेज देखा गया है। एक आयरन प्रोफाइल टेस्ट की सिफारिश की जाती है।</li>
159
+ <li>जॉन्डिस के लक्षण देखे गए हैं। कृपया LFT करवाएं।</li>
160
+ <li>HbA1c थोड़ा बढ़ा हुआ है — यह प्री-डायबिटीज़ का संकेत हो सकता है।</li>
161
+ <li>ऑक्सीजन स्तर कम दिख रहा है। पल्स ऑक्सीमीटर से दोबारा जांचें।</li>
162
+ </ul></details>
163
+
164
+ <details><summary><b>Telugu</b></summary><ul>
165
+ <li>మీ హిమోగ్లోబిన్ కొంచెం తక్కువగా ఉంది — ఇది తేలికపాటి అనీమియా సూచించవచ్చు. CBC, Iron పరీక్ష చేయించండి.</li>
166
+ <li>Iron నిల్వలు తక్కువగా కనిపించాయి. Iron ప్రొఫైల్ బ్లడ్ టెస్ట్ చేయించండి.</li>
167
+ <li>జాండీస్ సంకేతాలు గుర్తించబడ్డాయి. LFT చేయించండి.</li>
168
+ <li>HbA1c కొంచెం పెరిగింది — ఇది ప్రీ-డయాబెటిస్ సూచించవచ్చు.</li>
169
+ <li>ఆక్సిజన్ స్థాయి తక్కువగా ఉంది. తిరిగి పరీక్షించండి.</li>
170
+ </ul></details>
171
+ </div>
172
+ """
173
+
174
+ html_output += lang_blocks
175
  return html_output, frame_rgb
176
 
177
  with gr.Blocks() as demo: