File size: 765 Bytes
f45e20d
c0c1d35
 
5046ab9
b1927c9
7935c8d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1efe8d3
c111be5
1efe8d3
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
import fn
import gradio as gr

fn.load_model()

with gr.Blocks() as demo:
    audio = gr.Audio(sources="upload", type="filepath")
    model = gr.Dropdown(value='large-v3', choices=["tiny", "base", "small", "medium", "large", "large-v2", "large-v3"])
    run_button = gr.Button(value='Run')
    prompt = gr.Textbox(label='prompt')
    set_button = gr.Button(value='Set Prompt')
    text_only = gr.Textbox(label='output')
    text_with_timestamps = gr.Textbox(label='timestamps')

    run_button.click(
        fn=fn.speech_to_text,
        inputs=[audio, model],
        outputs=[text_only, text_with_timestamps],
    )

    set_button.click(
        fn=fn.set_prompt,
        inputs=[prompt],
        outputs=[],
    )

if __name__ == '__main__':
    demo.launch()