Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,7 +11,7 @@ available_models = {
|
|
| 11 |
|
| 12 |
|
| 13 |
# Create a Gradio interface with audio file and text inputs
|
| 14 |
-
def classify_toxicity(audio_file,
|
| 15 |
# Transcribe the audio file using Whisper ASR
|
| 16 |
whisper_module = evaluate.load("whisper")
|
| 17 |
transcription_results = whisper_module.compute(uploaded=audio_file)
|
|
@@ -25,13 +25,12 @@ def classify_toxicity(audio_file, text_input, selected_model):
|
|
| 25 |
|
| 26 |
toxicity_score = toxicity_results["toxicity"][0]
|
| 27 |
|
| 28 |
-
return f"Toxicity Score ({available_models[selected_model]}): {toxicity_score:.4f}"
|
| 29 |
|
| 30 |
iface = gr.Interface(
|
| 31 |
fn=classify_toxicity,
|
| 32 |
inputs=[
|
| 33 |
-
gr.Audio(source="upload", type="filepath", label="Upload Audio File
|
| 34 |
-
"text",
|
| 35 |
gr.Radio(available_models, type="value", label="Select Model")
|
| 36 |
],
|
| 37 |
outputs="text",
|
|
|
|
| 11 |
|
| 12 |
|
| 13 |
# Create a Gradio interface with audio file and text inputs
|
| 14 |
+
def classify_toxicity(audio_file, selected_model):
|
| 15 |
# Transcribe the audio file using Whisper ASR
|
| 16 |
whisper_module = evaluate.load("whisper")
|
| 17 |
transcription_results = whisper_module.compute(uploaded=audio_file)
|
|
|
|
| 25 |
|
| 26 |
toxicity_score = toxicity_results["toxicity"][0]
|
| 27 |
|
| 28 |
+
return transcribed_text, f"Toxicity Score ({available_models[selected_model]}): {toxicity_score:.4f}"
|
| 29 |
|
| 30 |
iface = gr.Interface(
|
| 31 |
fn=classify_toxicity,
|
| 32 |
inputs=[
|
| 33 |
+
gr.Audio(source="upload", type="filepath", label="Upload Audio File"),
|
|
|
|
| 34 |
gr.Radio(available_models, type="value", label="Select Model")
|
| 35 |
],
|
| 36 |
outputs="text",
|