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
Adds a gr.DownloadButton
component
#7518
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/3a94fad9a48b48e38312c9aba9b46018079d392e/gradio-4.19.2-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@3a94fad9a48b48e38312c9aba9b46018079d392e#subdirectory=client/python" |
🦄 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.
|
get_fetchable_url_or_file()
and adds a gr.DownloadButton
componentgr.DownloadButton
component
Will probably need to be rebased once #7528 is in |
render: bool = True, | ||
): | ||
""" | ||
Parameters: |
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.
Missing param for icon
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.
Added here as well as in gr.UploadButton
. Fixed the param description in gr.Button
Tested with this code. And seems like updating the |
Sooo I'm looking into this issue @dawoodkhan82 but it actually looks like a separate bug that resulted from #7528 You'll see the same error if you replace import gradio as gr
with gr.Blocks() as demo:
u = gr.UploadButton()
d = gr.DownloadButton()
demo.load(lambda : gr.UploadButton(icon="cheetah.jpg"), None, u)
# demo.load(lambda : gr.DownloadButton(icon="cheetah.jpg"), None, d)
demo.launch() I'm working on it, but it might be tricky and I think can potentially be a separate PR for better visibility. How does the rest of this PR look? |
Nvm the fix was easier than I thought -- I've merged it into this PR. Your example works for me now @dawoodkhan82 |
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.
LGTM, tested updating the icon as well. Thanks for including that fix @abidlabs
Thanks @dawoodkhan82 for testing thoroughly! |
After #7528, I wanted to go through the process of creating a new component with the new approach of working with the files, i.e. setting the URLs in the backend using
serve_static_file()
to mimic the work that a custom component developer would have to do.I decided to add the long-requested
gr.DownloadButton
component (fixes: #5426)