gradio icon indicating copy to clipboard operation
gradio copied to clipboard

Make it possible to call gradio.Slider.change only when slider is released

Open cakiki opened this issue 2 years ago • 6 comments

  • [x] I have searched to see if a similar issue already exists.

Is your feature request related to a problem? Please describe.
For apps without a "run" button logic, updating the slider immediately changes the state of the app, without the opportunity to scroll the slider toward a value of interest.

Describe the solution you'd like
It would be nice if gradio.Slider.change could be further customized to only be called when a user lets go of the slider.

Additional context
NA

cakiki avatar Feb 15 '23 19:02 cakiki

Seems reasonable, would it make sense to make this available via some flag to the Slider component or do we think this is just better default behaviour (or both, i guess)?

cc @abidlabs

pngwn avatar Feb 15 '23 20:02 pngwn

Can we use the existing Blur event here @pngwn ?

freddyaboulton avatar Feb 15 '23 20:02 freddyaboulton

+1 on this functionality, thanks!

meg-huggingface avatar Feb 15 '23 20:02 meg-huggingface

@freddyaboulton Yeah, we can just emit a new event for it, if blur makes sense for the api. Would be a quick one.

pngwn avatar Feb 15 '23 22:02 pngwn

Hi! since it was an issue with the label "good first contribute" i tried fixing this issue but i've run into some problem - i don't know how to debug the ui :) I'm making some changes - i think i know where the problem is, but how do i test it? Running the workbench at ui? the app at the packages folder? Should i create a new svelte application (never used it, react programmer here), then import my component and see if it works?

i'd like some advices and insights pls :)

@freddyaboulton or @pngwn, maybe you two will be able to help me!

or25 avatar Feb 19 '23 22:02 or25

@or25 You can test your changes by running a gradio demo from the gradio/demo dir. In this case you can test using the gradio/demo/kitchen_sink/run.py demo. You must keep this demo running and also at the same time run the frontend in dev mode to debug your frontend changes. Make sure you have the right versions below. Then run pnpm i from the gradio/ui dir to install all node packages; and finally run pnpm dev to run the frontend in dev mode. The app should be running on http://localhost:9876/

Prequisites:

Python 3.7+ pnpm version 7.x (optional for backend-only changes, but needed for any frontend changes)

Hope that helps

dawoodkhan82 avatar Feb 20 '23 17:02 dawoodkhan82

I did'nt get it actually. If i'm debugging the backend - i'm running the main.py file with the gradio module, then making changes to the gradio module source files. If i'm debugging the frontend i want to run pnpm at the ui folder. It runs, opening an application at port 3000, which has nothing but a gradio loading icon (as if loading the application). I don't know how to run the frontend then, i did exactly as you told so, and i don't actually get how running the demo and then running another session of frontend will affect each other.

or25 avatar Feb 20 '23 19:02 or25

Did you run a demo and open a new terminal window and run the UI? You need to run both at the same time. Make sure you pull latest main, the UI should start on localhost:9876.

pngwn avatar Feb 21 '23 10:02 pngwn

Closed via #3353, thanks @freddyaboulton!

abidlabs avatar Mar 03 '23 02:03 abidlabs