underscore2 commited on
Commit
f4f3763
·
verified ·
1 Parent(s): e7cbc28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -3,18 +3,18 @@ from transformers import pipeline
3
 
4
  # Define model names
5
  models = {
6
- "ModernBERT Base (gender)": "breadlicker45/ModernBERT-base-gender",
7
- "ModernBERT Large (gender)": "breadlicker45/ModernBERT-large-gender"
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": "Male (0)",
15
- "0": "Male (0)",
16
- "LABEL_1": "Female (1)",
17
- "1": "Female (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 Large (gender)" # Default model
52
  ),
53
  gr.Textbox(
54
  lines=2,
55
- placeholder="Enter text to classify for perceived gender...", # 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 Gender Classifier",
62
- description="Select a model and enter a sentence to see the perceived gender classification (Male=0, Female=1) and confidence scores. Note: Text-based gender classification can be unreliable and reflect societal biases.", # Updated 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