Closed RRighart closed 10 months ago
Hi @RRighart this is actually the intended behavior of the Clear button. The Clear button sets inputs components to have a null-ish value, it does not reset it. For example, for a gr.Textbox()
, it would set the value to be ""
, not the original default value.
In your case, I see a couple of options:
gr.Blocks()
API which allows you to define arbitrary buttons and assign arbitrary events. Here's a guide on how to use the Blocks API if you are not already familiar with it: https://www.gradio.app/guides/blocks-and-event-listenersThank you for your reply, I will indeed use gr.Blocks().
Describe the bug
My App intends to load images and run object detection. This all works. But when I am hitting the clear button underneath the image that is displayed, it not only removes the image (which is desired), but it also sets the default value of the slider at 0. This slider regulates the confidence value of the object detection and I’d prefer to always let it have a value of 0.20, sothat the display gets not filled with bounding boxes. This was actually working before with a previous version of Gradio (gradio==3.17.0) but now it keeps on setting it at zero (gradio==4.8.0). How could one set and leave the slider at the default value of 0.20 independent of pushing the clear button? Thank you very much in advance for your help!
Have you searched existing issues? 🔎
Reproduction
Screenshot
No response
Logs
No response
System Info
Severity
I can work around it