mskov commited on
Commit
33b1b5b
1 Parent(s): aa687d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -19
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
- input_block = gr.Row([
40
- gr.Column([
41
- gr.Audio(source="upload", type="filepath", label="Upload Audio File"),
42
- gr.Row([
43
- gr.Textbox(type="text", label="Enter Text", placeholder="Enter text here..."),
44
- gr.Button(label="Submit", type="submit")
45
- ])
46
- ]),
47
- gr.Radio(available_models, type="value", label="Select Model")
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()