Spaces:
Runtime error
Runtime error
Rob Caamano
commited on
App 2.3
Browse files
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 |
)
|