I’m trying to convert a simple example from interface to block, and I have missing part
The app displays every 2 seconds the temporary recording wav file name:
import gradio as gr
import time
def transcribe(audio, state=""):
time.sleep(2)
return audio
inf = gr.Interface(
fn=transcribe,
inputs=[
gr.Audio(source="microphone", type="filepath", streaming=True),
],
outputs=[
"textbox",
],
live=True)
if __name__ == "__main__":
inf.launch()
I’m trying to write this simple example with blocks, but I don’t know how to connect the transcribe function to the new file event ?
import gradio as gr
import time
def transcribe(audio, state=""):
time.sleep(2)
return audio
with gr.Blocks() as demo:
input_mic = gr.Audio(source="microphone", type="filepath", streaming=True)
out_text = gr.Textbox()
# how to connect transcribe function to the input_mic event ?
if __name__ == "__main__":
demo.launch()