Spaces:
Sleeping
Sleeping
Upload streamlit_app.py
Browse files- src/streamlit_app.py +3 -1
src/streamlit_app.py
CHANGED
|
@@ -9,7 +9,6 @@ from mtcnn import MTCNN
|
|
| 9 |
import joblib
|
| 10 |
import tensorflow.keras.backend as K
|
| 11 |
from huggingface_hub import hf_hub_download
|
| 12 |
-
|
| 13 |
import os
|
| 14 |
|
| 15 |
# === Custom Metric ===
|
|
@@ -19,6 +18,9 @@ def pearson_corr(y_true, y_pred):
|
|
| 19 |
return K.sum(x * y) / (K.sqrt(K.sum(K.square(x))) * K.sqrt(K.sum(K.square(y))) + K.epsilon())
|
| 20 |
|
| 21 |
# === Load model and scaler ===
|
|
|
|
|
|
|
|
|
|
| 22 |
model_path = hf_hub_download(
|
| 23 |
repo_id="jiinkwan/bmi-model", # 🔁 This should match your new model repo
|
| 24 |
filename="bmi_model_gender.keras"
|
|
|
|
| 9 |
import joblib
|
| 10 |
import tensorflow.keras.backend as K
|
| 11 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 12 |
import os
|
| 13 |
|
| 14 |
# === Custom Metric ===
|
|
|
|
| 18 |
return K.sum(x * y) / (K.sqrt(K.sum(K.square(x))) * K.sqrt(K.sum(K.square(y))) + K.epsilon())
|
| 19 |
|
| 20 |
# === Load model and scaler ===
|
| 21 |
+
# ✅ Set writable cache directory
|
| 22 |
+
os.environ["HF_HOME"] = "./hf_cache"
|
| 23 |
+
|
| 24 |
model_path = hf_hub_download(
|
| 25 |
repo_id="jiinkwan/bmi-model", # 🔁 This should match your new model repo
|
| 26 |
filename="bmi_model_gender.keras"
|