Spaces:
Runtime error
Runtime error
Update app.py
Browse files34 unmodified lines35363738394059 unmodified lines10010110210310410510634 unmodified lineshemoglobin_r2 = 0.385import joblibspo2_model = joblib.load("spo2_model_simulated.pkl")models = {"Hemoglobin": hemoglobin_model,59 unmodified linesvalue = models[label].predict([[random.uniform(0.2, 0.5) for _ in range(7)]])[0]test_values[label] = valuer2_scores[label] = 0.0 # simulate other 7D inputsheart_rate = int(60 + 30 * np.sin(np.mean(frame_rgb) / 255.0 * np.pi))skin_patch = frame_rgb[100:150, 100:150]skin_tone_index = np.mean(skin_patch) / 255 if skin_patch.size else 0.5brightness_variation = np.std(cv2.cvtColor(frame_rgb, cv2.COLOR_RGB2GRAY)) / 25534 unmodified lines3536373839404159 unmodified lines10110210310410510610710810911011111234 unmodified lineshemoglobin_r2 = 0.385import joblibspo2_model = joblib.load("spo2_model_simulated.pkl")hr_model = joblib.load("heart_rate_model.pkl")models = {"Hemoglobin": hemoglobin_model,59 unmodified linesvalue = models[label].predict([[random.uniform(0.2, 0.5) for _ in range(7)]])[0]test_values[label] = valuer2_scores[label] = 0.0 # simulate other 7D inputsgray = cv2.cvtColor(frame_rgb, cv2.COLOR_RGB2GRAY)green_std = np.std(frame_rgb[:, :, 1]) / 255brightness_std = np.std(gray) / 255tone_index = np.mean(frame_rgb[100:150, 100:150]) / 255 if frame_rgb[100:150, 100:150].size else 0.5hr_features = [brightness_std, green_std, tone_index]heart_rate = hr_model.predict([hr_features])[0]skin_patch = frame_rgb[100:150, 100:150]skin_tone_index = np.mean(skin_patch) / 255 if skin_patch.size else 0.5brightness_variation = np.std(cv2.cvtColor(frame_rgb, cv2.COLOR_RGB2GRAY)) / 255
app.py+7-1