-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix native plot lite demos #9160
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-pypi-previews.s3.amazonaws.com/a7654da8a5729fc95ef3584851b05405c051c08f/gradio-4.41.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@a7654da8a5729fc95ef3584851b05405c051c08f#subdirectory=client/python" Install Gradio JS Client from this PR npm install https://gradio-npm-previews.s3.amazonaws.com/a7654da8a5729fc95ef3584851b05405c051c08f/gradio-client-1.5.0.tgz |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
with gr.Row(): | ||
start = gr.DateTime("2021-01-01 00:00:00", label="Start") | ||
end = gr.DateTime("2021-01-05 00:00:00", label="End") | ||
apply_btn = gr.Button("Apply", scale=0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like code for the event triggers for apply_btn
and rescale_evt
was removed in this demo because it's commented out in the original code:
gradio/demo/native_plots/scatter_plot_demo.py
Lines 37 to 44 in 41d5ab9
# def rescale(select: gr.SelectData): | |
# return select.index | |
# rescale_evt = gr.on([plot.select for plot in time_graphs], rescale, None, [start, end]) | |
# for trigger in [apply_btn.click, rescale_evt.then]: | |
# trigger( | |
# lambda start, end: [gr.ScatterPlot(x_lim=[start, end])] * len(time_graphs), [start, end], time_graphs | |
# ) |
But without this,
start
, end
and apply_btn
are not used and become unnecessary, so maybe we can just remove this part to avoid confusion.I wonder why it's commented out in the first place, though. It might be better to re-add the missing event triggers.
Nice catch @hysts not sure why it was commented out in the first place. but I added the code back and it's working fine. it's also necessary for selecting a timespan in the graph. |
Just creates new demos for each where all the code is in one file. Lite playground element doesn't support multiple files yet.