Spaces:
Runtime error
Runtime error
Commit
·
0cc869c
1
Parent(s):
c939a1a
updated interface to include non fine-tuned model
Browse files
app.py
CHANGED
@@ -1,17 +1,22 @@
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
|
4 |
-
|
|
|
5 |
|
6 |
def transcribe(audio):
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
9 |
|
10 |
iface = gr.Interface(
|
11 |
fn=transcribe,
|
12 |
-
inputs=gr.Audio(
|
13 |
-
outputs="
|
14 |
-
|
|
|
15 |
description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",
|
16 |
)
|
17 |
|
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
|
4 |
+
pipe_fine = pipeline(model="zeihers-mart/whisper-small-swedish-basic")
|
5 |
+
pipe_raw = pipeline(model="openai/whisper-small")
|
6 |
|
7 |
def transcribe(audio):
|
8 |
+
text_sv = pipe_fine(audio)["text"]
|
9 |
+
print(f"Audio transcribed: {text_sv}")
|
10 |
+
text_raw= pipe_raw(audio)["text"]
|
11 |
+
print(f"Text translated: {text_raw}")
|
12 |
+
return text_sv, text_raw
|
13 |
|
14 |
iface = gr.Interface(
|
15 |
fn=transcribe,
|
16 |
+
inputs=gr.Audio(source="microphone", type="filepath"),
|
17 |
+
outputs=[gr.Textbox(label="Fine-tuned transcription"),
|
18 |
+
gr.Textbox(label="Whisper Transcription")],
|
19 |
+
title="Finetuned Whisper Swedish Small",
|
20 |
description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",
|
21 |
)
|
22 |
|