Spaces:
Build error
Build error
File size: 1,130 Bytes
7d13f08 5b077dd 7d13f08 4f15dfc 7d13f08 8e990cb 7d13f08 54e6010 7d13f08 54e6010 7d13f08 |
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 26 27 28 29 30 31 32 33 34 35 36 37 38 |
from transformers import pipeline
import gradio as gr
from pytube import YouTube
pipe = pipeline(model = 'CsanadT/whisper-small-se')
def live_performance(audio):
text = pipe(audio)['text']
return text
def url_performance(link):
yt = YouTube(str(link))
audio= yt.streams.filter(only_audio=True).first()
text = pipe(audio)['text']
return text
with gr.Blocks() as demo:
with gr.Tab('Live audio'):
iface = gr.Interface(
fn=live_performance,
inputs=gr.Audio(source="microphone", type="filepath"),
outputs="text",
title="Whisper Small Swedish",
description="Real-time demo for swedish speech recognition using a fine-tuned Whisper small model."
)
with gr.Tab('Transcription from URL'):
iface = gr.Interface(
fn=url_performance,
inputs=gr.Textbox(label='Paste the UL here'),
outputs="text",
title="Whisper Small Swedish",
description="Real-time demo for swedish speech recognition using a fine-tuned Whisper small model."
)
demo.launch() |