Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,10 +5,9 @@ import whisper
|
|
| 5 |
model = whisper.load_model("large")
|
| 6 |
|
| 7 |
def transcribe(audio_file):
|
| 8 |
-
#
|
| 9 |
-
#
|
| 10 |
-
|
| 11 |
-
audio = whisper.load_audio(audio_data)
|
| 12 |
audio = whisper.pad_or_trim(audio)
|
| 13 |
mel = whisper.log_mel_spectrogram(audio).to(model.device)
|
| 14 |
options = whisper.DecodingOptions()
|
|
@@ -18,7 +17,7 @@ def transcribe(audio_file):
|
|
| 18 |
# Create the Gradio interface
|
| 19 |
iface = gr.Interface(
|
| 20 |
fn=transcribe,
|
| 21 |
-
inputs=gr.Audio(label="Upload your audio file", type="
|
| 22 |
outputs="text",
|
| 23 |
title="Whisper ASR",
|
| 24 |
description="Upload an audio file and it will be transcribed using OpenAI's Whisper model."
|
|
|
|
| 5 |
model = whisper.load_model("large")
|
| 6 |
|
| 7 |
def transcribe(audio_file):
|
| 8 |
+
# Whisper expects a filepath, so we use the 'filepath' type in gr.Audio
|
| 9 |
+
# audio_file now directly contains the path to the uploaded file
|
| 10 |
+
audio = whisper.load_audio(audio_file)
|
|
|
|
| 11 |
audio = whisper.pad_or_trim(audio)
|
| 12 |
mel = whisper.log_mel_spectrogram(audio).to(model.device)
|
| 13 |
options = whisper.DecodingOptions()
|
|
|
|
| 17 |
# Create the Gradio interface
|
| 18 |
iface = gr.Interface(
|
| 19 |
fn=transcribe,
|
| 20 |
+
inputs=gr.Audio(label="Upload your audio file", type="filepath"),
|
| 21 |
outputs="text",
|
| 22 |
title="Whisper ASR",
|
| 23 |
description="Upload an audio file and it will be transcribed using OpenAI's Whisper model."
|