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
Share button #4651
Share button #4651
Conversation
The demo notebooks don't match the run.py files. Please run this command from the root of the repo and then commit the changes: pip install nbformat && cd demo && python generate_notebooks.py |
All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-4651-all-demos |
It would be good to add a note in this section https://gradio.app/sharing-your-app/#hosting-on-hf-spaces about changes that automatically apply when apps are deployed to Spaces -- so that if users are wondering how to enable/disable the button, they can find it in the docs easily |
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.
I'm not a fan of this feature in its current form for a few reasons:
- I think it clutters the UI. If we to add this then I think we should use the standard share arrow and lose the text. We don't have text labels for any other icons the smileys everywhere look very pushy. I also think we should position it somewhere else, not where out normal UI icons go but in another corner.
- I don't think this is really very maintainable, every component has its own share icon. It is similar to the StatusTracker issue, updating it is a nightmare. This also impacts custom components, is every custom component expected to implement a share icon in order to get that functionality? I think this needs rethinking.
- I don't think that sharing individual outputs makes sense in a lot of cases, a lot of the time those outputs are bound together and it makes sense to share them together. We could expand the API for this but then having the button on a specific component doesn't make much sense.
- No ability for other kinds of sharing and no API to implement a custom share function (to share on twitter for example)
If we are ok with 3 & 4 then thats fine, it isn't a hill i'll die on. I do feel more strongly about 1 & 2 though.
@pngwn @freddyaboulton @radames @gary149 @apolinario @abidlabs
with gr.Blocks() as demo:
input_img = gr.Image()
edit_command = gr.Textbox()
output_image = gr.Image()
def share(img, cmd, out):
return f"Edit with {cmd}", f"""
Input image: {img},
Command: {cmd}
Output image: {out}
"""
output_image.share(share, [input_img, edit_command, output_image]) |
Should've addressed everything, except a global Can I get a re-review @abidlabs |
All of my comments seem to have been addressed, thanks @aliabid94! Just noticed a few other small issues when testing it out:
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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 @aliabid94! Thanks for addressing all of the feedback. One tiny thing is that the Gallery sometimes takes a while to upload for me, but that might just because it has to upload all of the images in series. Something we can try to optimize later on, but this PR is great
Can't really parallelize download / uploads, network bandwidth is a fixed bottleneck. The reason the Gallery uploads take a while in the fake_gan scenario is that these are URLs for some large images, and we need to download each file, convert to a blob, and re-upload the file to hf.co/uploads. hf.co/uploads can't take a direct URL so we need to do this extra step. |
Could there be a way to opt-out of this somehow? This causes a pretty large performance hit on the stable-diffusion-webui during initial page load for users who have a lot of models, which creates a bunch of Gradio components which are then iterated through. I left some more details on the commit where the Gradio version was bumped. AUTOMATIC1111/stable-diffusion-webui@362789a#commitcomment-123587924 |
It's probably the same problem as #4841 |
Ah, I didn't catch that, you're right -- thanks! |
@catboxanon Yeah this introduced some nasty performance issues for large apps. I'll be fixing this this week. |
Creates shareable button attached to Image, Gallery, Chatbot, Audio, Video.
Automatically set to True on Spaces. See example code below.
To test locally:
https://huggingface.co/uploads
withhttps://radames-temp-proxy.hf.space/https://huggingface.co/uploads
in utils.ts (to avoid CORS error)pnpm run build
to avoid CORS errorShould also test on spaces using built package for gradio version (can be found in requirements.txt of https://huggingface.co/spaces/gradio-pr-deploys/pr-4651-all-demos)
Closes: #2749