Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,31 +1,18 @@
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
|
4 |
-
pipe = pipeline(model="vasi001/
|
5 |
-
|
6 |
-
|
7 |
-
def transcribe(rec=None, file=None):
|
8 |
-
if rec is not None:
|
9 |
-
audio = rec
|
10 |
-
elif file is not None:
|
11 |
-
audio = file
|
12 |
-
else:
|
13 |
-
return "Provide a recording or a file."
|
14 |
|
|
|
15 |
text = pipe(audio)["text"]
|
16 |
return text
|
17 |
|
18 |
-
|
19 |
iface = gr.Interface(
|
20 |
-
fn=transcribe,
|
21 |
-
inputs=
|
22 |
-
gr.Audio(source="microphone", type="filepath", optional=True),
|
23 |
-
gr.Audio(source="upload", type="filepath", optional=True),
|
24 |
-
],
|
25 |
outputs="text",
|
26 |
title="Whisper Small Swedish",
|
27 |
-
description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper model.",
|
28 |
)
|
29 |
|
30 |
-
|
31 |
-
iface.launch()
|
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
|
4 |
+
pipe = pipeline(model="vasi001/Whisper-small") # change to "your-username/the-name-you-picked"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
def transcribe(audio):
|
7 |
text = pipe(audio)["text"]
|
8 |
return text
|
9 |
|
|
|
10 |
iface = gr.Interface(
|
11 |
+
fn=transcribe,
|
12 |
+
inputs=gr.Audio(source="microphone", type="filepath"),
|
|
|
|
|
|
|
13 |
outputs="text",
|
14 |
title="Whisper Small Swedish",
|
15 |
+
description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",
|
16 |
)
|
17 |
|
18 |
+
iface.launch()
|
|