Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -7,8 +7,8 @@ models = {
|
|
7 |
"ModernBERT Large (Go-Emotions)": "cirimus/modernbert-large-go-emotions"
|
8 |
}
|
9 |
|
10 |
-
# Function to load the selected model
|
11 |
-
def classify_text(
|
12 |
classifier = pipeline("text-classification", model=models[model_name], top_k=None)
|
13 |
predictions = classifier(text)
|
14 |
return {pred["label"]: pred["score"] for pred in predictions[0]}
|
@@ -29,7 +29,7 @@ interface = gr.Interface(
|
|
29 |
)
|
30 |
],
|
31 |
outputs=gr.Label(num_top_classes=5),
|
32 |
-
title="
|
33 |
description="Select a model and enter a sentence to see its associated emotions and confidence scores.",
|
34 |
)
|
35 |
|
|
|
7 |
"ModernBERT Large (Go-Emotions)": "cirimus/modernbert-large-go-emotions"
|
8 |
}
|
9 |
|
10 |
+
# Function to load the selected model and classify text
|
11 |
+
def classify_text(model_name, text):
|
12 |
classifier = pipeline("text-classification", model=models[model_name], top_k=None)
|
13 |
predictions = classifier(text)
|
14 |
return {pred["label"]: pred["score"] for pred in predictions[0]}
|
|
|
29 |
)
|
30 |
],
|
31 |
outputs=gr.Label(num_top_classes=5),
|
32 |
+
title="Emotion Classifier",
|
33 |
description="Select a model and enter a sentence to see its associated emotions and confidence scores.",
|
34 |
)
|
35 |
|