Spaces:
Runtime error
Runtime error
File size: 778 Bytes
abaf86c 7069d5c abaf86c 7069d5c abaf86c 7069d5c abaf86c 7069d5c abaf86c |
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
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()
|