Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -36,24 +36,14 @@ def classify_toxicity(audio_file, text_input, selected_model):
|
|
36 |
return toxicity_score, transcribed_text
|
37 |
# return f"Toxicity Score ({available_models[selected_model]}): {toxicity_score:.4f}"
|
38 |
|
39 |
-
|
40 |
-
gr.Column(
|
41 |
-
gr.Audio(source="upload", type="filepath", label="Upload Audio File"),
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
])
|
49 |
-
|
50 |
-
iface = gr.Interface(
|
51 |
-
fn=classify_toxicity,
|
52 |
-
inputs=input_block,
|
53 |
-
outputs="text",
|
54 |
-
live=True,
|
55 |
-
title="Toxicity Classifier with ASR",
|
56 |
-
description="Upload an audio file or enter text to classify its toxicity using the selected model.",
|
57 |
-
)
|
58 |
|
59 |
iface.launch()
|
|
|
36 |
return toxicity_score, transcribed_text
|
37 |
# return f"Toxicity Score ({available_models[selected_model]}): {toxicity_score:.4f}"
|
38 |
|
39 |
+
with gr.Blocks() as iface:
|
40 |
+
with gr.Column():
|
41 |
+
aud_input = gr.Audio(source="upload", type="filepath", label="Upload Audio File"),
|
42 |
+
with gr.Row():
|
43 |
+
text = gr.Textbox(label="Enter Text", placeholder="Enter text here..."),
|
44 |
+
submit = gr.Button(label="Submit", type="submit")
|
45 |
+
radio = gr.Radio(available_models, type="value", label="Select Model")
|
46 |
+
out_text = gr.Textbox()
|
47 |
+
submit.click(fn=classify_toxicity, inputs=[aud_input, text, radio], outputs=out_text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
iface.launch()
|