Spaces:
Runtime error
Runtime error
Aurélie GABU commited on
Commit ·
3a105f9
1
Parent(s): fc54f44
gitignore and predict modified
Browse files- .gitignore +3 -2
- App/predict.py +6 -2
.gitignore
CHANGED
|
@@ -4,6 +4,7 @@ venv/
|
|
| 4 |
.venv/
|
| 5 |
.pytest_cache/
|
| 6 |
.coverage
|
|
|
|
| 7 |
*.joblib
|
| 8 |
-
*.
|
| 9 |
-
App/model
|
|
|
|
| 4 |
.venv/
|
| 5 |
.pytest_cache/
|
| 6 |
.coverage
|
| 7 |
+
App/modl/
|
| 8 |
*.joblib
|
| 9 |
+
*.json
|
| 10 |
+
App/model/modele_final_xgb.joblib
|
App/predict.py
CHANGED
|
@@ -3,10 +3,13 @@ import pandas as pd
|
|
| 3 |
from App.schemas import EmployeeFeatures
|
| 4 |
import json
|
| 5 |
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# Chemin des fichiers
|
| 8 |
-
chemin_model = Path("
|
| 9 |
-
chemin_mapping = Path("
|
| 10 |
|
| 11 |
# Variables chargées
|
| 12 |
model = None
|
|
@@ -14,6 +17,7 @@ classes_mapping = None
|
|
| 14 |
Features = list(EmployeeFeatures.model_fields.keys())
|
| 15 |
|
| 16 |
|
|
|
|
| 17 |
# Chargement des fichiers: fonction pour charger le modèle, le mapping afin de permettre à l'API de démarrer m^me si les éléments ne sont pas présents
|
| 18 |
def files_load():
|
| 19 |
global model, classes_mapping
|
|
|
|
| 3 |
from App.schemas import EmployeeFeatures
|
| 4 |
import json
|
| 5 |
from pathlib import Path
|
| 6 |
+
from huggingface_hub import hf_hub_download
|
| 7 |
+
|
| 8 |
+
MODEL_REPO = "Diaure/Futurisys-Model"
|
| 9 |
|
| 10 |
# Chemin des fichiers
|
| 11 |
+
chemin_model = Path(hf_hub_download(repo_id=MODEL_REPO, filename="modele_final_xgb.joblib"))
|
| 12 |
+
chemin_mapping = Path(hf_hub_download(repo_id=MODEL_REPO, filename="mapping_classes.json"))
|
| 13 |
|
| 14 |
# Variables chargées
|
| 15 |
model = None
|
|
|
|
| 17 |
Features = list(EmployeeFeatures.model_fields.keys())
|
| 18 |
|
| 19 |
|
| 20 |
+
|
| 21 |
# Chargement des fichiers: fonction pour charger le modèle, le mapping afin de permettre à l'API de démarrer m^me si les éléments ne sont pas présents
|
| 22 |
def files_load():
|
| 23 |
global model, classes_mapping
|