Fix the model class
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ import streamlit as st
|
|
| 7 |
|
| 8 |
import torch
|
| 9 |
import datasets
|
| 10 |
-
from transformers import
|
| 11 |
|
| 12 |
model_name = st.text_input("Enter a model's name on HF")
|
| 13 |
# MODEL_NAME = "AMR-KELEG/NADI2024-baseline"
|
|
@@ -33,7 +33,7 @@ DIALECTS = ["Algeria",
|
|
| 33 |
assert len(DIALECTS) == 18
|
| 34 |
|
| 35 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 36 |
-
model =
|
| 37 |
|
| 38 |
def predict_top_p(text, P=0.9):
|
| 39 |
"""Predict the top dialects with an accumulative confidence of at least P."""
|
|
|
|
| 7 |
|
| 8 |
import torch
|
| 9 |
import datasets
|
| 10 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 11 |
|
| 12 |
model_name = st.text_input("Enter a model's name on HF")
|
| 13 |
# MODEL_NAME = "AMR-KELEG/NADI2024-baseline"
|
|
|
|
| 33 |
assert len(DIALECTS) == 18
|
| 34 |
|
| 35 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 36 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 37 |
|
| 38 |
def predict_top_p(text, P=0.9):
|
| 39 |
"""Predict the top dialects with an accumulative confidence of at least P."""
|