Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,18 +3,18 @@ from transformers import pipeline
|
|
| 3 |
|
| 4 |
# Define model names
|
| 5 |
models = {
|
| 6 |
-
"ModernBERT
|
| 7 |
-
"ModernBERT
|
| 8 |
}
|
| 9 |
|
| 10 |
# Define the mapping for user-friendly labels
|
| 11 |
# Note: Transformers pipelines often output 'LABEL_0', 'LABEL_1'.
|
| 12 |
# We handle potential variations like just '0', '1'.
|
| 13 |
label_map = {
|
| 14 |
-
"LABEL_0": "
|
| 15 |
-
"0": "
|
| 16 |
-
"LABEL_1": "
|
| 17 |
-
"1": "
|
| 18 |
}
|
| 19 |
|
| 20 |
# Function to load the selected model and classify text
|
|
@@ -48,18 +48,18 @@ interface = gr.Interface(
|
|
| 48 |
gr.Dropdown(
|
| 49 |
list(models.keys()),
|
| 50 |
label="Select Model",
|
| 51 |
-
value="ModernBERT
|
| 52 |
),
|
| 53 |
gr.Textbox(
|
| 54 |
lines=2,
|
| 55 |
-
placeholder="Enter text to classify
|
| 56 |
value="This is an example sentence." # Changed example text
|
| 57 |
)
|
| 58 |
],
|
| 59 |
# The gr.Label component works well for showing classification scores
|
| 60 |
outputs=gr.Label(num_top_classes=2), # Show both classes explicitly
|
| 61 |
-
title="ModernBERT
|
| 62 |
-
description="
|
| 63 |
)
|
| 64 |
|
| 65 |
# Launch the app
|
|
|
|
| 3 |
|
| 4 |
# Define model names
|
| 5 |
models = {
|
| 6 |
+
"ModernBERT Slop Classifier v1": "underscore2/modernbert_base_slop_classifier",
|
| 7 |
+
"ModernBERT Slop Classifier v2": "underscore2/modernbert_base_slop_classifier_v2"
|
| 8 |
}
|
| 9 |
|
| 10 |
# Define the mapping for user-friendly labels
|
| 11 |
# Note: Transformers pipelines often output 'LABEL_0', 'LABEL_1'.
|
| 12 |
# We handle potential variations like just '0', '1'.
|
| 13 |
label_map = {
|
| 14 |
+
"LABEL_0": "Human (0)",
|
| 15 |
+
"0": "Human (0)",
|
| 16 |
+
"LABEL_1": "LLM (1)",
|
| 17 |
+
"1": "LLM (1)"
|
| 18 |
}
|
| 19 |
|
| 20 |
# Function to load the selected model and classify text
|
|
|
|
| 48 |
gr.Dropdown(
|
| 49 |
list(models.keys()),
|
| 50 |
label="Select Model",
|
| 51 |
+
value="ModernBERT Slop Classifier v2" # Default model
|
| 52 |
),
|
| 53 |
gr.Textbox(
|
| 54 |
lines=2,
|
| 55 |
+
placeholder="Enter text to classify", # Corrected placeholder
|
| 56 |
value="This is an example sentence." # Changed example text
|
| 57 |
)
|
| 58 |
],
|
| 59 |
# The gr.Label component works well for showing classification scores
|
| 60 |
outputs=gr.Label(num_top_classes=2), # Show both classes explicitly
|
| 61 |
+
title="ModernBERT Slop Classifier",
|
| 62 |
+
description="Enter a sentence to see the slop score and confidence scores", # Updated description
|
| 63 |
)
|
| 64 |
|
| 65 |
# Launch the app
|