File size: 835 Bytes
a95a91f
 
 
a1357dd
bdffb1c
4c963d0
a95a91f
4c963d0
a95a91f
d1800c9
a95a91f
 
 
 
 
d1800c9
a95a91f
 
 
 
 
 
 
697fd34
9f2ec46
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
import gradio as gr
import whisper

# duplicate this space to run on higher CPU power for the large (very precise and multi-lingual) model to work best
 
def speech_to_text(uploaded, model_size):
    model = whisper.load_model(model_size)
    source = uploaded if uploaded is not None else ''
    result = model.transcribe(source)
    return f'{result["text"]}'

gr.Interface(
    title="",
    thumbnail="",
    css="""
    footer {visibility: xhidden}
    .gr-prose p{text-align: center;}
    .gr-button {background: black;color: white}
    """,
    description="",
    fn=speech_to_text,
    inputs=[
        gr.Audio(source="upload", type="filepath", label="Upload Audio"), 
        gr.Dropdown(label="Select model size",value="large",choices=["tiny", "base", "small", "medium", "large"])],
    outputs="text").launch(debug = True)