Skip to content
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

Add step param to Number #5047

Merged
merged 12 commits into from Aug 1, 2023
Merged

Add step param to Number #5047

merged 12 commits into from Aug 1, 2023

Conversation

hannahblair
Copy link
Collaborator

@hannahblair hannahblair commented Jul 31, 2023

Description

Adds a step param to the Number component so we can define the interval at which the input value increases or decreases with the HTML up/down arrows.

Demo:

import gradio as gr

with gr.Blocks() as demo:
    gr.Number(maximum=50, label="Number", steps=10)

demo.launch()

Closes: #4737

🎯 PRs Should Target Issues

Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.

Not adhering to this guideline will result in the PR being closed.

Tests

  1. PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests: bash scripts/run_all_tests.sh

  2. You may need to run the linters: bash scripts/format_backend.sh and bash scripts/format_frontend.sh

@vercel
Copy link

vercel bot commented Jul 31, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
gradio ✅ Ready (Inspect) Visit Preview Aug 1, 2023 10:27am

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Jul 31, 2023

🎉 Chromatic build completed!

There are 4 visual changes to review.
There are 0 failed tests to fix.

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Jul 31, 2023

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/app minor
@gradio/form minor
gradio minor
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Add step param to Number

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Jul 31, 2023

All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-5047-all-demos


You can install the changes in this PR by running:

pip install https://gradio-builds.s3.amazonaws.com/2f9d6add4a06a16cdff335777433d858d95e1c34/gradio-3.39.0-py3-none-any.whl

@abidlabs
Copy link
Member

Works great @hannahblair! Tested by itself and along with minimum and maximum. The behavior when using minimum and maximum is that the steps start from minimum, which is fine. I tried to include this in the docstring (feel free to trim if its too long)

Some small nits, otherwise LGTM

@hannahblair hannahblair merged commit 883ac36 into main Aug 1, 2023
12 checks passed
@hannahblair hannahblair deleted the add-step-param-to-number branch August 1, 2023 11:44
@pngwn pngwn mentioned this pull request Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add step to gr.Number
3 participants