File size: 848 Bytes
a159b10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr

def create_interface():
    with gr.Blocks() as interface:
        gr.Markdown("# Word Counter")
        gr.Markdown("Enter a word to count, then start listening to your microphone")

        with gr.Row():
            target_word = gr.Textbox(label="Target Word", placeholder="Enter word to count")

        with gr.Row():
            counter_display = gr.Number(label="Count", value=0, interactive=False)

        with gr.Row():
            audio_input = gr.Audio(sources=["microphone"], type="filepath", streaming=True)

        with gr.Row():
            start_btn = gr.Button("Start", variant="primary")
            stop_btn = gr.Button("Stop", variant="secondary")
            reset_btn = gr.Button("Reset", variant="stop")

    return interface, target_word, counter_display, audio_input, start_btn, stop_btn, reset_btn