-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 show_heading
param to gr.Label
#9987
base: main
Are you sure you want to change the base?
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-pypi-previews.s3.amazonaws.com/44574cc4c01a9d4cd8f26c2e4bb0d935e8b2c3d6/gradio-5.6.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@44574cc4c01a9d4cd8f26c2e4bb0d935e8b2c3d6#subdirectory=client/python" Install Gradio JS Client from this PR npm install https://gradio-npm-previews.s3.amazonaws.com/44574cc4c01a9d4cd8f26c2e4bb0d935e8b2c3d6/gradio-client-1.8.0.tgz Use Lite from this PR <script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/44574cc4c01a9d4cd8f26c2e4bb0d935e8b2c3d6/dist/lite.js""></script> |
🦄 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.
|
hide_heading
param to gr.Label()hide_heading
param to gr.Label
I misunderstood earlier, but I think it would be clearer if if the docstring said something like:
also nit, but I think we usually use |
hide_heading
param to gr.Labelshow_heading
param to gr.Label
lol that was a very arrogant find and replace on my part. thanks @abidlabs, changes made |
Hey @hannahblair code changes look good now, but when I test this, e.g. with: import gradio as gr
with gr.Blocks() as demo:
gr.Label({"cat": 0.7, "dog": 0.3}, show_heading=False)
demo.launch() I notice two issues: (1) The component label is overlapping the topmost category: (2) I don't think this is due to this PR, but you'll notice that the bar has an unusual green color fill inside the orange outline. It looks like the bar width (i.e. the width of the orange outline) is CONFIDENCE% is of the full component width and the green fill is CONFIDENCE% of the bar width. The fill should take up the entire bar width and imo the fill should be the same color as the outline (primary hue) |
I ran into this when trying to use uBlock Origin to hide the header for demo purposes. The only way to make it look good was instead to replace the text in the |
Description
Adds a
show_heading
param to gr.Label to allow hiding a the large heading in gr.Labels with multiple labels. show_heading will be void in components with just one label.Closes: #9975
🎯 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.
Testing and Formatting Your Code
PRs will only be merged if tests pass on CI. We recommend at least running the backend tests locally, please set up your Gradio environment locally and run the backed tests:
bash scripts/run_backend_tests.sh
Please run these bash scripts to automatically format your code:
bash scripts/format_backend.sh
, and (if you made any changes to non-Python files)bash scripts/format_frontend.sh