camillebrl commited on
Commit
847feee
·
verified ·
1 Parent(s): 8857568

Update tasks/text.py

Browse files
Files changed (1) hide show
  1. tasks/text.py +10 -1
tasks/text.py CHANGED
@@ -58,7 +58,16 @@ 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
 
58
 
59
  # Make random predictions (placeholder for actual model inference)
60
  true_labels = test_dataset["label"]
61
+ config = AutoConfig.from_pretrained("camillebrl/ModernBERT-envclaims-overfit")
62
+ label2id = config.label2id
63
+ classifier = pipeline(
64
+ "text-classification",
65
+ "camillebrl/ModernBERT-envclaims-overfit",
66
+ device="cpu"
67
+ )
68
+
69
+ predictions = [label2id[classifier(quote)[0]["label"]] for quote in test_dataset["quote"]]
70
+ print(predictions)
71
 
72
  #--------------------------------------------------------------------------------------------
73
  # YOUR MODEL INFERENCE STOPS HERE