File size: 694 Bytes
b7d825d
 
 
3a4a7b8
b7d825d
c0d6c5e
6340556
 
c1ac5b6
 
 
 
 
 
b7d825d
 
 
375f512
b7d825d
 
 
 
 
e14e7c5
e07a5eb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from transformers import pipeline
import gradio as gr

pipe = pipeline(model="Hoft/whisper-small-swedish-asr")  # change to "your-username/the-name-you-picked"

def transcribe(audio, file):
    print("AUDIO:",audio)
    print("FILE:", file)
    if audio is not None:
        text = pipe(audio)["text"]
        return text
    if file is not None:
        text = pipe(file)["text"]
        return text

iface = gr.Interface(
    fn=transcribe, 
    inputs=[gr.Audio(source="microphone", type="filepath"), gr.File()], 
    outputs="text",
    title="Whisper Small Swedish",
    description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",
)


iface.launch()