File size: 608 Bytes
edbeae5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gradio as gr
from transformers import pipeline

# Use whisper-base for better Swedish transcription on CPU
asr = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=-1)

def transcribe(audio):
    result = asr(audio)
    return result["text"]

gr.Interface(
    fn=transcribe,
    inputs=gr.Audio(source="upload", type="filepath", label="Upload Swedish Audio"),
    outputs=gr.Textbox(label="Transcribed Text (Swedish)"),
    title="Swedish Whisper Transcriber",
    description="This app uses OpenAI Whisper (base) to transcribe spoken Swedish into text for free."
).launch()