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

Upload / Droparea for images and videos #5809

Closed
1 task done
henryruhs opened this issue Oct 5, 2023 · 1 comment
Closed
1 task done

Upload / Droparea for images and videos #5809

henryruhs opened this issue Oct 5, 2023 · 1 comment
Labels
new component Involves creating a new component

Comments

@henryruhs
Copy link

henryruhs commented Oct 5, 2023

  • I have searched to see if a similar issue already exists.

Is your feature request related to a problem? Please describe.

In FaceFusion and some other roop forks, we have a target_path droparea that allows images and videos for later processing.

Bildschirmaufzeichnung.vom.05.10.2023.17.57.07.webm

At the moment this has been solved this way:

  1. Use gradio.File as an entry point
  2. Once a file has been uploaded gradio.File becomes invisible
  3. The upload path will be forwarded to gradio.Image or gradio.Video

Source: https://github.com/facefusion/facefusion/blob/master/facefusion/uis/components/target.py#L16-L44

Describe the solution you'd like

The problem with the current approach: we cannot unload the temporary files for gradio.File - therefore the disc space and RAM is allocated twice for no good reason.

Potential solutions

  1. Gradio could recognize temp file paths and reuse them instead of creating a fresh one
  2. Forward the upload / blob to the Image or Video component
  3. Unload of components (not just hiding) and related temp files
  4. A gradio.Media component

Additional context

FaceFusion stores the processed images and videos to an given path. Once done, we display this in the UI. From my observation this is causing a similar issue. A copy from the output_path is is stored within another temporary Gradio file.

grafik

@abidlabs abidlabs added the new component Involves creating a new component label Oct 5, 2023
@abidlabs
Copy link
Member

abidlabs commented Nov 7, 2023

Hey! We've now made it possible for Gradio users to create their own custom components -- meaning that you can write some Python and JavaScript (Svelte), and publish it as a Gradio component. You can use it in your own Gradio apps, or share it so that anyone can use it in their Gradio apps. Here are some examples of custom Gradio components:

You can see the source code for those components by clicking the "Files" icon and then clicking "src". The complete source code for the backend and frontend is visible. In particular, its very fast if you want to build off an existing component. We've put together a Guide: https://www.gradio.app/guides/five-minute-guide, and we're happy to help. Hopefully this will help address this issue.

@abidlabs abidlabs closed this as completed Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new component Involves creating a new component
Projects
None yet
Development

No branches or pull requests

2 participants