mskov commited on
Commit
61fa7d4
1 Parent(s): 46fb075

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -22,6 +22,14 @@ emo_dict = {
22
  'neu': 'Neutral'
23
  }
24
 
 
 
 
 
 
 
 
 
25
  pipe = pipeline("automatic-speech-recognition")
26
 
27
  # Create a Gradio interface with audio file and text inputs
@@ -54,7 +62,7 @@ def classify_toxicity(audio_file, text_input, classify_anxiety):
54
  text_classifier = pipeline("zero-shot-classification", model="MoritzLaurer/mDeBERTa-v3-base-mnli-xnli")
55
 
56
  sequence_to_classify = transcribed_text
57
- candidate_labels = classify_anxiety
58
  # classification_output = classifier(sequence_to_classify, candidate_labels, multi_label=False)
59
  classification_output = text_classifier(sequence_to_classify, candidate_labels, multi_label=False)
60
  print(classification_output)
@@ -69,7 +77,7 @@ def classify_toxicity(audio_file, text_input, classify_anxiety):
69
 
70
  with gr.Blocks() as iface:
71
  with gr.Column():
72
- classify = gr.Radio(["racial identity hate", "LGBTQ+ hate", "sexually explicit", "misophonia"])
73
  with gr.Column():
74
  aud_input = gr.Audio(source="upload", type="filepath", label="Upload Audio File")
75
  text = gr.Textbox(label="Enter Text", placeholder="Enter text here...")
 
22
  'neu': 'Neutral'
23
  }
24
 
25
+ # static classes for now, but it would be best ot have the user select from multiple, and to enter their own
26
+ class_options = {
27
+ "racism": ["racism", "hate speech", "bigotry", "racially targeted", "racially diminutive", "racial slur", "ethnic slur", "ethnic hate", "pro-white nationalism"],
28
+ "LGBTQ+ hate": ["homophobia", "gay slur", "trans slur", "homophobic slur", "transphobia", "anti-LBGTQ+", "hate speech"],
29
+ "sexually explicit": ["sexually explicit", "sexually coercive", "sexual exploitation", "vulgar", "raunchy", "sexually demeaning", "sexual violence", "victim blaming"],
30
+ "misophonia": ["chewing", "breathing", "mouthsounds", "popping", "sneezing", "yawning", "smacking", "sniffling", "panting"]
31
+ }
32
+
33
  pipe = pipeline("automatic-speech-recognition")
34
 
35
  # Create a Gradio interface with audio file and text inputs
 
62
  text_classifier = pipeline("zero-shot-classification", model="MoritzLaurer/mDeBERTa-v3-base-mnli-xnli")
63
 
64
  sequence_to_classify = transcribed_text
65
+ candidate_labels = class_options.get(classify_anxiety, [])
66
  # classification_output = classifier(sequence_to_classify, candidate_labels, multi_label=False)
67
  classification_output = text_classifier(sequence_to_classify, candidate_labels, multi_label=False)
68
  print(classification_output)
 
77
 
78
  with gr.Blocks() as iface:
79
  with gr.Column():
80
+ classify = gr.Radio(["racism", "LGBTQ+ hate", "sexually explicit", "misophonia"])
81
  with gr.Column():
82
  aud_input = gr.Audio(source="upload", type="filepath", label="Upload Audio File")
83
  text = gr.Textbox(label="Enter Text", placeholder="Enter text here...")