Rob Caamano commited on
Commit
4a0592e
·
unverified ·
1 Parent(s): 395b5b7
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -23,6 +23,11 @@ mod_name = model_options[selected_model]
23
 
24
  tokenizer = AutoTokenizer.from_pretrained(mod_name)
25
  model = AutoModelForSequenceClassification.from_pretrained(mod_name)
 
 
 
 
 
26
  clf = pipeline(
27
  "text-classification", model=model, tokenizer=tokenizer, return_all_scores=True
28
  )
 
23
 
24
  tokenizer = AutoTokenizer.from_pretrained(mod_name)
25
  model = AutoModelForSequenceClassification.from_pretrained(mod_name)
26
+
27
+ # Update the id2label mapping for the fine-tuned model
28
+ if selected_model == "Fine-tuned Toxicity Model":
29
+ model.config.id2label = {i: f"LABEL_{i}" for i in range(model.config.num_labels)}
30
+
31
  clf = pipeline(
32
  "text-classification", model=model, tokenizer=tokenizer, return_all_scores=True
33
  )