Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -241,7 +241,7 @@ def analyze_face(input_data):
|
|
241 |
features = extract_features(frame_rgb, landmarks)
|
242 |
|
243 |
# Convert features to pandas DataFrame with correct column names (matching the training phase)
|
244 |
-
features_df = pd.DataFrame([features], columns=["%
|
245 |
|
246 |
test_values = {}
|
247 |
r2_scores = {}
|
@@ -261,7 +261,7 @@ def analyze_face(input_data):
|
|
261 |
green_std = np.std(frame_rgb[:, :, 1]) / 255
|
262 |
brightness_std = np.std(gray) / 255
|
263 |
tone_index = np.mean(frame_rgb[100:150, 100:150]) / 255 if frame_rgb[
|
264 |
-
|
265 |
hr_features = [brightness_std, green_std, tone_index]
|
266 |
heart_rate = float(np.clip(hr_model.predict([hr_features])[0], 60, 100))
|
267 |
skin_patch = frame_rgb[100:150, 100:150]
|
|
|
241 |
features = extract_features(frame_rgb, landmarks)
|
242 |
|
243 |
# Convert features to pandas DataFrame with correct column names (matching the training phase)
|
244 |
+
features_df = pd.DataFrame([features], columns=["%red pixel", "%green pixel", "%blue pixel"]) # Ensure lowercase column names
|
245 |
|
246 |
test_values = {}
|
247 |
r2_scores = {}
|
|
|
261 |
green_std = np.std(frame_rgb[:, :, 1]) / 255
|
262 |
brightness_std = np.std(gray) / 255
|
263 |
tone_index = np.mean(frame_rgb[100:150, 100:150]) / 255 if frame_rgb[
|
264 |
+
100:150, 100:150].size else 0.5
|
265 |
hr_features = [brightness_std, green_std, tone_index]
|
266 |
heart_rate = float(np.clip(hr_model.predict([hr_features])[0], 60, 100))
|
267 |
skin_patch = frame_rgb[100:150, 100:150]
|