|
import gradio as gr |
|
|
|
def triggered_by_clear_event(hidden_in): |
|
print(hidden_in) |
|
return "Hello" |
|
|
|
with gr.Blocks() as demo: |
|
with gr.Row(): |
|
with gr.Column(): |
|
audio_in = gr.Audio(label="Audio Component • clear event doesn't work", source="microphone", type="filepath") |
|
image_in = gr.Image(label="Image Component • clear event works", source="upload", type="filepath") |
|
hidden_in = gr.Textbox(value="HIDDEN TEXT", visible=False) |
|
submit_btn : gr.Button("Submit") |
|
result = gr.Textbox(label="Result") |
|
|
|
audio_in.clear( |
|
fn = triggered_by_clear_event, |
|
inputs = [hidden_in], |
|
outputs = [result] |
|
) |
|
|
|
image_in.clear( |
|
fn = triggered_by_clear_event, |
|
inputs = [hidden_in], |
|
outputs = [result] |
|
) |
|
|
|
demo.queue().launch() |
|
|