Update app.py
Browse files
app.py
CHANGED
@@ -87,7 +87,12 @@ def analyze_face(image):
|
|
87 |
return "<div style='color:red;'>⚠️ Error: Face not detected.</div>", None
|
88 |
landmarks = result.multi_face_landmarks[0].landmark
|
89 |
features = extract_features(frame_rgb, landmarks)
|
90 |
-
test_values = {
|
|
|
|
|
|
|
|
|
|
|
91 |
heart_rate = int(60 + 30 * np.sin(np.mean(frame_rgb) / 255.0 * np.pi))
|
92 |
spo2 = min(100, max(90, 97 + (heart_rate % 5 - 2)))
|
93 |
rr = int(12 + abs(heart_rate % 5 - 2))
|
|
|
87 |
return "<div style='color:red;'>⚠️ Error: Face not detected.</div>", None
|
88 |
landmarks = result.multi_face_landmarks[0].landmark
|
89 |
features = extract_features(frame_rgb, landmarks)
|
90 |
+
test_values = {}
|
91 |
+
for label in models:
|
92 |
+
if label == "Hemoglobin":
|
93 |
+
test_values[label] = models[label].predict([features])[0] # 3D input
|
94 |
+
else:
|
95 |
+
test_values[label] = models[label].predict([[random.uniform(0.2, 0.5) for _ in range(7)]])[0] # simulate other 7D inputs
|
96 |
heart_rate = int(60 + 30 * np.sin(np.mean(frame_rgb) / 255.0 * np.pi))
|
97 |
spo2 = min(100, max(90, 97 + (heart_rate % 5 - 2)))
|
98 |
rr = int(12 + abs(heart_rate % 5 - 2))
|