-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Ensure the height
param in gr.File
works as expected
#10209
Conversation
* change max-height to height
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-pypi-previews.s3.amazonaws.com/2d97a33b5bef4ca209ae482fc38fc16e7b03b0eb/gradio-5.9.1-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@2d97a33b5bef4ca209ae482fc38fc16e7b03b0eb#subdirectory=client/python" Install Gradio JS Client from this PR npm install https://gradio-npm-previews.s3.amazonaws.com/2d97a33b5bef4ca209ae482fc38fc16e7b03b0eb/gradio-client-1.8.0.tgz Use Lite from this PR <script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/2d97a33b5bef4ca209ae482fc38fc16e7b03b0eb/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.
|
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.
This fix does not work for me. This PR changes the behavior of height
to force a height that applies when files are uploaded:
however, this is contrary to the docstring, which says that the height
parameter serves as a "maximum height of the file component when files are present". So this is not correct.
The underlying issue is that height
should also apply to the file upload box, and that does not seem to be happening, as you can check with an example like this:
import gradio as gr
with gr.Blocks() as demo:
file = gr.File(
label='File', file_count='single', interactive=True, visible=True,
height=50,
)
demo.launch()
and this PR doesn't change that behavior.
Oh you're right, I massively jumped the gun with this one! Pushing up actual fixes shortly |
* apply height param in upload
Nice @hannahblair indeed this fixes it for me. Perhaps we add a story to prevent regressions. |
agreed |
Description
Height wasn't being properly applied in
gr.File
, and we also weren't accept theheight
as a string even though it says so in the documentation for height infile.py
.Closes: #10184
🎯 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