Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,14 +4,19 @@ from fastapi.middleware.cors import CORSMiddleware
|
|
| 4 |
from huggingface_hub import hf_hub_download
|
| 5 |
import joblib
|
| 6 |
import pandas as pd
|
|
|
|
| 7 |
|
| 8 |
# -----------------------------
|
| 9 |
# Download model + columns from Hugging Face Hub
|
| 10 |
# -----------------------------
|
| 11 |
REPO_ID = "MAZEN00/Player"
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
model = joblib.load(model_path)
|
| 17 |
model_columns = joblib.load(columns_path)
|
|
|
|
| 4 |
from huggingface_hub import hf_hub_download
|
| 5 |
import joblib
|
| 6 |
import pandas as pd
|
| 7 |
+
import os
|
| 8 |
|
| 9 |
# -----------------------------
|
| 10 |
# Download model + columns from Hugging Face Hub
|
| 11 |
# -----------------------------
|
| 12 |
REPO_ID = "MAZEN00/Player"
|
| 13 |
|
| 14 |
+
# Use local cache inside project (not /.cache)
|
| 15 |
+
cache_dir = "./cache"
|
| 16 |
+
os.makedirs(cache_dir, exist_ok=True)
|
| 17 |
+
|
| 18 |
+
model_path = hf_hub_download(repo_id=REPO_ID, filename="modeel.joblib", cache_dir=cache_dir)
|
| 19 |
+
columns_path = hf_hub_download(repo_id=REPO_ID, filename="columns.pkl", cache_dir=cache_dir)
|
| 20 |
|
| 21 |
model = joblib.load(model_path)
|
| 22 |
model_columns = joblib.load(columns_path)
|