Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -84,13 +84,14 @@ def classify_toxicity(audio_file, text_input, classify_anxiety):
|
|
| 84 |
else:
|
| 85 |
# model = model_cache[model_name]
|
| 86 |
# class_names = classify_anxiety.split(",")
|
| 87 |
-
|
| 88 |
class_str = ""
|
| 89 |
-
for elm in
|
| 90 |
class_str += elm + ","
|
| 91 |
#class_names = class_names_temp.split(",")
|
| 92 |
class_names = class_str.split(",")
|
| 93 |
print("class names ", class_names, "classify_anxiety ", classify_anxiety)
|
|
|
|
| 94 |
# tokenizer = get_tokenizer(multilingual=".en" not in model_name)
|
| 95 |
tokenizer= WhisperTokenizer.from_pretrained("openai/whisper-large")
|
| 96 |
model = "whisper-large"
|
|
@@ -116,13 +117,13 @@ def classify_toxicity(audio_file, text_input, classify_anxiety):
|
|
| 116 |
|
| 117 |
with gr.Blocks() as iface:
|
| 118 |
with gr.Column():
|
| 119 |
-
|
| 120 |
with gr.Column():
|
| 121 |
aud_input = gr.Audio(source="upload", type="filepath", label="Upload Audio File")
|
| 122 |
text = gr.Textbox(label="Enter Text", placeholder="Enter text here...")
|
| 123 |
submit_btn = gr.Button(label="Run")
|
| 124 |
with gr.Column():
|
| 125 |
out_text = gr.Textbox()
|
| 126 |
-
submit_btn.click(fn=classify_toxicity, inputs=[aud_input, text,
|
| 127 |
|
| 128 |
iface.launch()
|
|
|
|
| 84 |
else:
|
| 85 |
# model = model_cache[model_name]
|
| 86 |
# class_names = classify_anxiety.split(",")
|
| 87 |
+
class_names_list = class_options.get(classify_anxiety, [])
|
| 88 |
class_str = ""
|
| 89 |
+
for elm in class_names_list:
|
| 90 |
class_str += elm + ","
|
| 91 |
#class_names = class_names_temp.split(",")
|
| 92 |
class_names = class_str.split(",")
|
| 93 |
print("class names ", class_names, "classify_anxiety ", classify_anxiety)
|
| 94 |
+
|
| 95 |
# tokenizer = get_tokenizer(multilingual=".en" not in model_name)
|
| 96 |
tokenizer= WhisperTokenizer.from_pretrained("openai/whisper-large")
|
| 97 |
model = "whisper-large"
|
|
|
|
| 117 |
|
| 118 |
with gr.Blocks() as iface:
|
| 119 |
with gr.Column():
|
| 120 |
+
anxiety_class = gr.Radio(["racism", "LGBTQ+ hate", "sexually explicit", "misophonia"])
|
| 121 |
with gr.Column():
|
| 122 |
aud_input = gr.Audio(source="upload", type="filepath", label="Upload Audio File")
|
| 123 |
text = gr.Textbox(label="Enter Text", placeholder="Enter text here...")
|
| 124 |
submit_btn = gr.Button(label="Run")
|
| 125 |
with gr.Column():
|
| 126 |
out_text = gr.Textbox()
|
| 127 |
+
submit_btn.click(fn=classify_toxicity, inputs=[aud_input, text, anxiety_class], outputs=out_text)
|
| 128 |
|
| 129 |
iface.launch()
|