File size: 1,135 Bytes
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
import hopsworks
from pytube import Youtube

amp = hopsworks.login()
data = amp.get_model_registry()

pipe = pipeline(model = 'CsanadT/model_name')

def live_performance(audio):
    text = pipe(audio)['text']
    return text

def url_performance(link):
    selected_video = Youtube(str(link), only_audio = True)
    

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 Hungarian",
            description="Real-time demo for Hungarian 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 Hungarian",
            description="Real-time demo for Hungarian speech recognition using a fine-tuned Whisper small model."
        )

demo.launch()