aur-beau commited on
Commit
6eaeaec
·
1 Parent(s): 309ccd2

updated code

Browse files
models/model_tfidf_linearsvc.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b362701d616def1dffcd59059ce4c9e9ef8f53561ffebe5225eafaf65b70362
3
+ size 326963
tasks/text.py CHANGED
@@ -2,7 +2,7 @@ from fastapi import APIRouter
2
  from datetime import datetime
3
  from datasets import load_dataset
4
  from sklearn.metrics import accuracy_score
5
- import random
6
 
7
  from .utils.evaluation import TextEvaluationRequest
8
  from .utils.emissions import tracker, clean_emissions_data, get_space_info
@@ -55,10 +55,14 @@ async def evaluate_text(request: TextEvaluationRequest):
55
  # YOUR MODEL INFERENCE CODE HERE
56
  # Update the code below to replace the random baseline by your model inference within the inference pass where the energy consumption and emissions are tracked.
57
  #--------------------------------------------------------------------------------------------
58
-
59
- # Make random predictions (placeholder for actual model inference)
 
 
 
 
60
  true_labels = test_dataset["label"]
61
- predictions = [random.randint(0, 7) for _ in range(len(true_labels))]
62
 
63
  #--------------------------------------------------------------------------------------------
64
  # YOUR MODEL INFERENCE STOPS HERE
 
2
  from datetime import datetime
3
  from datasets import load_dataset
4
  from sklearn.metrics import accuracy_score
5
+ import pickle
6
 
7
  from .utils.evaluation import TextEvaluationRequest
8
  from .utils.emissions import tracker, clean_emissions_data, get_space_info
 
55
  # YOUR MODEL INFERENCE CODE HERE
56
  # Update the code below to replace the random baseline by your model inference within the inference pass where the energy consumption and emissions are tracked.
57
  #--------------------------------------------------------------------------------------------
58
+
59
+ # Charger le modèle sauvegardé avec pickle
60
+ with open('../models/model_grid_search.pkl', 'rb') as f:
61
+ model_loaded = pickle.load(f)
62
+
63
+ # Make predictions (placeholder for actual model inference)
64
  true_labels = test_dataset["label"]
65
+ predictions = model_loaded.predict(test_dataset["quote"])
66
 
67
  #--------------------------------------------------------------------------------------------
68
  # YOUR MODEL INFERENCE STOPS HERE