Aurélie GABU commited on
Commit
c78c1d8
·
1 Parent(s): f0b9a6f

Changes accepted

Browse files
Files changed (3) hide show
  1. .github/workflows/ci.yml +0 -8
  2. App/main.py +0 -3
  3. App/predict.py +0 -19
.github/workflows/ci.yml CHANGED
@@ -20,7 +20,6 @@ jobs:
20
 
21
  - uses: actions/checkout@v4
22
 
23
- <<<<<<< HEAD
24
  - name: Install Poetry
25
  run: pip install poetry
26
 
@@ -29,13 +28,6 @@ jobs:
29
 
30
  - name: Run tests
31
  run: poetry run pytest
32
- =======
33
- - name: Install dependencies
34
- run: |
35
- pip install .
36
- pip install -r requirements.txt
37
- pip install pytest
38
- >>>>>>> fc539b23b8706255fb5b2ad6d1e6a8bae3b8fb2f
39
 
40
  - name: Run tests
41
  run: pytest
 
20
 
21
  - uses: actions/checkout@v4
22
 
 
23
  - name: Install Poetry
24
  run: pip install poetry
25
 
 
28
 
29
  - name: Run tests
30
  run: poetry run pytest
 
 
 
 
 
 
 
31
 
32
  - name: Run tests
33
  run: pytest
App/main.py CHANGED
@@ -8,13 +8,10 @@ app = FastAPI(
8
  version="0.1.0"
9
  )
10
 
11
- <<<<<<< HEAD
12
  @app.get("/")
13
  def root():
14
  return {"status": "API OK"}
15
 
16
- =======
17
- >>>>>>> fc539b23b8706255fb5b2ad6d1e6a8bae3b8fb2f
18
  @app.post("/predict")
19
  def predict(data: EmployeeFeatures):
20
  """
 
8
  version="0.1.0"
9
  )
10
 
 
11
  @app.get("/")
12
  def root():
13
  return {"status": "API OK"}
14
 
 
 
15
  @app.post("/predict")
16
  def predict(data: EmployeeFeatures):
17
  """
App/predict.py CHANGED
@@ -5,15 +5,7 @@ import json
5
  from pathlib import Path
6
  from huggingface_hub import hf_hub_download
7
 
8
- <<<<<<< HEAD
9
  MODEL_REPO = "Diaure/xgb_model"
10
- =======
11
- MODEL_REPO = "Diaure/Futurisys-Model"
12
-
13
- # Chemin des fichiers
14
- chemin_model = Path(hf_hub_download(repo_id=MODEL_REPO, filename="modele_final_xgb.joblib"))
15
- chemin_mapping = Path(hf_hub_download(repo_id=MODEL_REPO, filename="mapping_classes.json"))
16
- >>>>>>> fc539b23b8706255fb5b2ad6d1e6a8bae3b8fb2f
17
 
18
  # Variables chargées
19
  model = None
@@ -25,7 +17,6 @@ Features = list(EmployeeFeatures.model_fields.keys())
25
  # 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
26
  def files_load():
27
  global model, classes_mapping
28
- <<<<<<< HEAD
29
 
30
  if model is None:
31
  chemin_model = Path(hf_hub_download(repo_id=MODEL_REPO, filename="modele_final_xgb.joblib"))
@@ -37,16 +28,6 @@ def files_load():
37
  chemin_mapping = Path(hf_hub_download(repo_id=MODEL_REPO, filename="mapping_classes.json"))
38
  # if not chemin_mapping.exists():
39
  # raise RuntimeError("Mapping des classes introuvable.")
40
- =======
41
- if model is None:
42
- if not chemin_model.exists():
43
- raise RuntimeError("Eléments du modèle introuvable.")
44
- model =joblib.load(chemin_model)
45
-
46
- if classes_mapping is None:
47
- if not chemin_mapping.exists():
48
- raise RuntimeError("Mapping des classes introuvable.")
49
- >>>>>>> fc539b23b8706255fb5b2ad6d1e6a8bae3b8fb2f
50
  with open(chemin_mapping) as f:
51
  classes_mapping = json.load(f)
52
 
 
5
  from pathlib import Path
6
  from huggingface_hub import hf_hub_download
7
 
 
8
  MODEL_REPO = "Diaure/xgb_model"
 
 
 
 
 
 
 
9
 
10
  # Variables chargées
11
  model = None
 
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
 
20
 
21
  if model is None:
22
  chemin_model = Path(hf_hub_download(repo_id=MODEL_REPO, filename="modele_final_xgb.joblib"))
 
28
  chemin_mapping = Path(hf_hub_download(repo_id=MODEL_REPO, filename="mapping_classes.json"))
29
  # if not chemin_mapping.exists():
30
  # raise RuntimeError("Mapping des classes introuvable.")
 
 
 
 
 
 
 
 
 
 
31
  with open(chemin_mapping) as f:
32
  classes_mapping = json.load(f)
33