Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,7 +14,7 @@ available_models = {
|
|
| 14 |
|
| 15 |
|
| 16 |
# Create a Gradio interface with audio file and text inputs
|
| 17 |
-
def classify_toxicity(audio_file,
|
| 18 |
# Transcribe the audio file using Whisper ASR
|
| 19 |
if audio_file != None:
|
| 20 |
whisper_module = evaluate.load("whisper")
|
|
@@ -23,9 +23,7 @@ def classify_toxicity(audio_file, text_file, selected_model):
|
|
| 23 |
# Extract the transcribed text
|
| 24 |
transcribed_text = transcription_results["transcription"]
|
| 25 |
else:
|
| 26 |
-
|
| 27 |
-
for line in f:
|
| 28 |
-
transcribed_text.append(line)
|
| 29 |
|
| 30 |
# Load the selected toxicity classification model
|
| 31 |
toxicity_module = evaluate.load("toxicity", selected_model)
|
|
@@ -38,7 +36,7 @@ def classify_toxicity(audio_file, text_file, selected_model):
|
|
| 38 |
iface = gr.Interface(
|
| 39 |
fn=classify_toxicity,
|
| 40 |
inputs=[
|
| 41 |
-
gr.Audio(source="upload", type="filepath", label="Upload Audio File"),
|
| 42 |
gr.Radio(available_models, type="value", label="Select Model")
|
| 43 |
],
|
| 44 |
outputs="text",
|
|
|
|
| 14 |
|
| 15 |
|
| 16 |
# Create a Gradio interface with audio file and text inputs
|
| 17 |
+
def classify_toxicity(audio_file, text_input, selected_model):
|
| 18 |
# Transcribe the audio file using Whisper ASR
|
| 19 |
if audio_file != None:
|
| 20 |
whisper_module = evaluate.load("whisper")
|
|
|
|
| 23 |
# Extract the transcribed text
|
| 24 |
transcribed_text = transcription_results["transcription"]
|
| 25 |
else:
|
| 26 |
+
transcribed_text = text_input
|
|
|
|
|
|
|
| 27 |
|
| 28 |
# Load the selected toxicity classification model
|
| 29 |
toxicity_module = evaluate.load("toxicity", selected_model)
|
|
|
|
| 36 |
iface = gr.Interface(
|
| 37 |
fn=classify_toxicity,
|
| 38 |
inputs=[
|
| 39 |
+
gr.Audio(source="upload", type="filepath", label="Upload Audio File"), text,
|
| 40 |
gr.Radio(available_models, type="value", label="Select Model")
|
| 41 |
],
|
| 42 |
outputs="text",
|