AXEL DARMOUNI commited on
Commit
a0b479c
·
1 Parent(s): 9685f7b

modified text.py

Browse files
Files changed (1) hide show
  1. tasks/text.py +10 -1
tasks/text.py CHANGED
@@ -6,6 +6,15 @@ import random
6
 
7
  from .utils.evaluation import TextEvaluationRequest
8
  from .utils.emissions import tracker, clean_emissions_data, get_space_info
 
 
 
 
 
 
 
 
 
9
 
10
  router = APIRouter()
11
 
@@ -58,7 +67,7 @@ async def evaluate_text(request: TextEvaluationRequest):
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
 
6
 
7
  from .utils.evaluation import TextEvaluationRequest
8
  from .utils.emissions import tracker, clean_emissions_data, get_space_info
9
+ from transformers import pipeline
10
+
11
+ # load model from huggingface.co/models using our repository id
12
+ classifier = pipeline(
13
+ task="text-classification",
14
+ model="axel-darmouni/test_modernbert_finetuned",
15
+ tokenizer="answerdotai/ModernBERT-base",
16
+ )
17
+
18
 
19
  router = APIRouter()
20
 
 
67
 
68
  # Make random predictions (placeholder for actual model inference)
69
  true_labels = test_dataset["label"]
70
+ predictions = [classifier(sample)["label"] for sample in test_dataset["quote"]]
71
 
72
  #--------------------------------------------------------------------------------------------
73
  # YOUR MODEL INFERENCE STOPS HERE