Aurélie GABU commited on
Commit
f0b9a6f
·
2 Parent(s): 61a5df0 3a105f9

Résolution du merge

Browse files
.github/workflows/ci.yml CHANGED
@@ -20,6 +20,7 @@ jobs:
20
 
21
  - uses: actions/checkout@v4
22
 
 
23
  - name: Install Poetry
24
  run: pip install poetry
25
 
@@ -28,6 +29,13 @@ jobs:
28
 
29
  - name: Run tests
30
  run: poetry run pytest
 
 
 
 
 
 
 
31
 
32
  - name: Run tests
33
  run: pytest
 
20
 
21
  - uses: actions/checkout@v4
22
 
23
+ <<<<<<< HEAD
24
  - name: Install Poetry
25
  run: pip install poetry
26
 
 
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
App/main.py CHANGED
@@ -8,10 +8,13 @@ app = FastAPI(
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
  """
 
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
  """
App/predict.py CHANGED
@@ -5,7 +5,15 @@ import json
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,6 +25,7 @@ Features = list(EmployeeFeatures.model_fields.keys())
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,6 +37,16 @@ def files_load():
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
 
 
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
  # 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
  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
 
pyproject.toml CHANGED
@@ -21,8 +21,12 @@ dependencies = [
21
  "catboost ==1.2.7",
22
  "numba ==0.59.1",
23
  "llvmlite ==0.42.0",
 
24
  "ipykernel>=6.25,<7.0",
25
  "huggingface-hub = 1.3.1"
 
 
 
26
  ]
27
 
28
 
 
21
  "catboost ==1.2.7",
22
  "numba ==0.59.1",
23
  "llvmlite ==0.42.0",
24
+ <<<<<<< HEAD
25
  "ipykernel>=6.25,<7.0",
26
  "huggingface-hub = 1.3.1"
27
+ =======
28
+ "ipykernel>=6.25,<7.0"
29
+ >>>>>>> fc539b23b8706255fb5b2ad6d1e6a8bae3b8fb2f
30
  ]
31
 
32
 
requirements.txt CHANGED
@@ -6,9 +6,13 @@ Pygments==2.19.2
6
  pytest==9.0.2
7
  fastapi==0.115.0
8
  uvicorn==0.30.1
 
9
  httpx==0.27.0
10
  huggingface-hub==1.3.1
11
  joblib==1.4.2
12
  pandas==2.2.2
13
  scikit-learn==1.4.2
14
- xgboost ==2.0.3
 
 
 
 
6
  pytest==9.0.2
7
  fastapi==0.115.0
8
  uvicorn==0.30.1
9
+ <<<<<<< HEAD
10
  httpx==0.27.0
11
  huggingface-hub==1.3.1
12
  joblib==1.4.2
13
  pandas==2.2.2
14
  scikit-learn==1.4.2
15
+ xgboost ==2.0.3
16
+ =======
17
+ httpx==0.27.0
18
+ >>>>>>> fc539b23b8706255fb5b2ad6d1e6a8bae3b8fb2f