File size: 642 Bytes
0a6a4fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from transformers import pipeline
import gradio as gr

pipe = pipeline(model="SaladSlayer00/another_local")


def transcribe(rec=None, file=None):
    if rec is not None:
        audio = rec
    elif file is not None:
        audio = file
    else:
        return "Provide a recording or a file."

    text = pipe(audio)["text"]
    return text


iface = gr.Interface(
    fn=transcribe,
    inputs=[
        gr.Audio(type="filepath")
    ],
    outputs="text",
    title="Whisper Small Italian",
    description="Realtime demo for Italian speech recognition using a fine-tuned Whisper model.",
)


iface.launch()