Chrysoula's picture
Update app.py
6340556
raw
history blame
694 Bytes
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()