Update app.py
Browse files
app.py
CHANGED
|
@@ -74,6 +74,49 @@ def analyze_face(image):
|
|
| 74 |
build_table("❤️ Vital Signs", [("SpO2", spo2, (95, 100)), ("Heart Rate", heart_rate, (60, 100)), ("Respiratory Rate", rr, (12, 20))])
|
| 75 |
])
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
return html_output, frame_rgb
|
| 78 |
|
| 79 |
# Gradio App Layout
|
|
|
|
| 74 |
build_table("❤️ Vital Signs", [("SpO2", spo2, (95, 100)), ("Heart Rate", heart_rate, (60, 100)), ("Respiratory Rate", rr, (12, 20))])
|
| 75 |
])
|
| 76 |
|
| 77 |
+
summary = "<div style='margin-top:20px;padding:12px;border:1px dashed #999;background:#fcfcfc;'>"
|
| 78 |
+
summary += "<h4>📝 Summary for You</h4><ul>"
|
| 79 |
+
if hb < 13.5:
|
| 80 |
+
summary += "<li>Your hemoglobin is a bit low — this could mean mild anemia. Consider a CBC test and iron supplements.</li>"
|
| 81 |
+
if iron < 60 or ferritin < 30:
|
| 82 |
+
summary += "<li>Signs of low iron storage detected. An iron profile blood test is recommended.</li>"
|
| 83 |
+
if bilirubin > 1.2:
|
| 84 |
+
summary += "<li>Some signs of jaundice were detected. Please consult for a Liver Function Test (LFT).</li>"
|
| 85 |
+
if hba1c > 5.7:
|
| 86 |
+
summary += "<li>Your HbA1c is slightly elevated — this can signal pre-diabetes. A fasting glucose test may help.</li>"
|
| 87 |
+
if spo2 < 95:
|
| 88 |
+
summary += "<li>Oxygen levels appear below normal. Please recheck with a pulse oximeter if symptoms persist.</li>"
|
| 89 |
+
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>"
|
| 90 |
+
|
| 91 |
+
html_output += summary
|
| 92 |
+
html_output += "<br><div style='margin-top:20px;padding:12px;border:2px solid #2d87f0;background:#f2faff;text-align:center;border-radius:8px;">
|
| 93 |
+
<h4>📞 Book a Lab Test</h4>
|
| 94 |
+
<p>Prefer to get your tests confirmed at a nearby center? Click below to find certified labs in your area.</p>
|
| 95 |
+
<button style='padding:10px 20px;background:#007BFF;color:#fff;border:none;border-radius:5px;cursor:pointer;'>Find Labs Near Me</button>
|
| 96 |
+
</div>"
|
| 97 |
+
|
| 98 |
+
lang_blocks = """
|
| 99 |
+
<div style='margin-top:20px;padding:12px;border:1px dashed #999;background:#f9f9f9;'>
|
| 100 |
+
<h4>🗣️ Summary in Your Language</h4>
|
| 101 |
+
<details><summary><b>Hindi</b></summary><ul>
|
| 102 |
+
<li>आपका हीमोग्लोबिन थोड़ा कम है — यह हल्के एनीमिया का संकेत हो सकता है। कृपया CBC और आयरन टेस्ट करवाएं।</li>
|
| 103 |
+
<li>लो आयरन स्टोरेज देखा गया है। एक आयरन प्रोफाइल टेस्ट की सिफारिश की जाती है।</li>
|
| 104 |
+
<li>जॉन्डिस के लक्षण देखे गए हैं। कृपया LFT करवाएं।</li>
|
| 105 |
+
<li>HbA1c थोड़ा बढ़ा हुआ है — यह प्री-डायबिटीज़ का संकेत हो सकता है।</li>
|
| 106 |
+
<li>ऑक्सीजन स्तर कम दिख रहा है। पल्स ऑक्सीमीटर से दोबारा जांचें।</li>
|
| 107 |
+
</ul></details>
|
| 108 |
+
|
| 109 |
+
<details><summary><b>Telugu</b></summary><ul>
|
| 110 |
+
<li>మీ హిమోగ్లోబిన్ కొంచెం తక్కువగా ఉంది — ఇది తేలికపాటి అనీమియా సూచించవచ్చు. CBC, Iron పరీక్ష చేయించండి.</li>
|
| 111 |
+
<li>Iron నిల్వలు తక్కువగా కనిపించాయి. Iron ప్రొఫైల్ బ్లడ్ టెస్ట్ చేయించండి.</li>
|
| 112 |
+
<li>జాండీస్ సంకేతాలు గుర్తించబడ్డాయి. LFT చేయించండి.</li>
|
| 113 |
+
<li>HbA1c కొంచెం పెరిగింది — ఇది ప్రీ-డయాబెటిస్ సూచించవచ్చు.</li>
|
| 114 |
+
<li>ఆక్సిజన్ స్థాయి తక్కువగా ఉంది. తిరిగి పరీక్షించండి.</li>
|
| 115 |
+
</ul></details>
|
| 116 |
+
</div>
|
| 117 |
+
"""
|
| 118 |
+
|
| 119 |
+
html_output += lang_blocks
|
| 120 |
return html_output, frame_rgb
|
| 121 |
|
| 122 |
# Gradio App Layout
|