HopeLiang's picture
Upload app.py
d78f3c8
raw
history blame
778 Bytes
from transformers import pipeline
import gradio as gr
pipe1 = pipeline(model="khalidey/ID2223_Lab2_Whisper_SV") # change to "your-username/the-name-you-picked"
pipe2 = pipeline('text-generation', model='birgermoell/swedish-gpt')
def transcribe(audio):
text = pipe1(audio)["text"]
return text
def generateText(audio):
text = pipe1(audio)["text"]
generated_text = pipe2(text, max_length = 30, num_return_sequences=1)['generated_text']
return generated_text
iface = gr.Interface(
fn=transcribe,
inputs=gr.Audio(source="microphone", type="filepath"),
outputs=["text","generated_text"],
title="Whisper Small Swedish",
description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",
)
iface.launch()