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

Videos are copied twice to RAM #55

Closed
felixsanz opened this issue Aug 30, 2023 · 13 comments
Closed

Videos are copied twice to RAM #55

felixsanz opened this issue Aug 30, 2023 · 13 comments

Comments

@felixsanz
Copy link

When a new video is uploaded to the UI, it appears 2 times (with different folder names) inside /tmp/gradio, which is mounted to the RAM in my system, so the RAM usage is doubled. Any idea why this happen? I can't find where the problem is

@henryruhs
Copy link
Contributor

Could you help me understanding the issue by providing some screenshots? I doubt it is loaded 2 times.

@felixsanz
Copy link
Author

Sure. I deleted /tmp/gradio to make sure nothing exists.

1693412793

Then I drag and drop the video into the target zone.

1693412744

And if you check /tmp/gradio now...

1693412797

2 folders with different hash but the same video. Since this is mounted to RAM it's always consuming double RAM than needed.

I know I can move the temp folder to a disk but in RAM is fast and nice, it's just that it shouldn't be here duplicated.

@henryruhs
Copy link
Contributor

henryruhs commented Aug 30, 2023

This is indeed an issue cause by the my integration.

To have just one drop area for images and videos I use gradio.File instead of gradio.Image and gradio.Video next to each other. According to the media type I display gradio.File instead of gradio.Image.

I didn't expect they load that file twice to the RAM.

@felixsanz
Copy link
Author

felixsanz commented Aug 30, 2023

It happens with every asset. The face image you upload to the "source" zone, it happens too (if that helps)

@henryruhs
Copy link
Contributor

The source.py is made the same way like the target.py - not because it is needed but to have the same UI concept.

@henryruhs
Copy link
Contributor

henryruhs commented Aug 30, 2023

grafik

Could be solved either with Tabs or by unloaded the File components once the media type is known.

@felixsanz
Copy link
Author

Unloading the old "file" instance and keeping the "video" or "image" one seems to be a better solution to me, so the UI doesn't get more complex without needing

@henryruhs
Copy link
Contributor

I agree... but that needs lot of refactoring

@felixsanz
Copy link
Author

I agree... but that needs lot of refactoring

why? just when the file is uploaded... there is already 2 times, remove the old one with os.remove()

@henryruhs
Copy link
Contributor

henryruhs commented Aug 30, 2023

Like I know the Gradio hash... anyway, I gonna fix that asap. Thanks for the report.

@henryruhs
Copy link
Contributor

The good news: source_file and target_file are no longer used across the application. I use source_image, target_image and target_video now.

The bad news: unloading the file components does not result in the wanted behavior.

This might stay unfixed for 1.1.0 in case nobody sends a pull request until tomorrow.

@henryruhs
Copy link
Contributor

henryruhs commented Sep 13, 2023

I created a issue: gradio-app/gradio#5809

Please vote it up!

@henryruhs
Copy link
Contributor

I resolved this as wontfix... closed on the Gradio side - the decision is made that we move away from this framework.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants