Spaces:
Sleeping
Sleeping
Add upload audio file option.
Browse files
app.py
CHANGED
@@ -3,13 +3,21 @@ import gradio as gr
|
|
3 |
|
4 |
pipe = pipeline(model="Yilin98/whisper-small-hi") # change to "your-username/the-name-you-picked"
|
5 |
|
6 |
-
def transcribe(audio):
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
return text
|
9 |
|
10 |
iface = gr.Interface(
|
11 |
fn=transcribe,
|
12 |
-
inputs=
|
|
|
|
|
13 |
outputs="text",
|
14 |
title="Whisper Small Swedish",
|
15 |
description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",
|
|
|
3 |
|
4 |
pipe = pipeline(model="Yilin98/whisper-small-hi") # change to "your-username/the-name-you-picked"
|
5 |
|
6 |
+
def transcribe(audio=None, file=None):
|
7 |
+
if (audio is None) and (file is None):
|
8 |
+
return "No audio provided!"
|
9 |
+
elif audio is not None:
|
10 |
+
input=audio
|
11 |
+
elif file is not None:
|
12 |
+
imput=file
|
13 |
+
text = pipe(input)["text"]
|
14 |
return text
|
15 |
|
16 |
iface = gr.Interface(
|
17 |
fn=transcribe,
|
18 |
+
inputs=[
|
19 |
+
gr.Audio(source="microphone", type="filepath"),
|
20 |
+
gr.Audio(source="upload", type="filepath")],
|
21 |
outputs="text",
|
22 |
title="Whisper Small Swedish",
|
23 |
description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",
|