-
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
Ability to customize Gradio's output folder for gr.File
uploads
#3597
Comments
The reason we do it like this is:
I don't think we'd change the above behavior, but we could certainly allow users to set a parent directory where all temporary files would be stored so:
|
I also don't see a problem with the behavior of images being added to separate hashed folders. As long as all temporary folders/files end up contained within a single folder rather than dumped into system TEMP root, cleaning should be easy. The general problem with using system temp root, is that many different types of files from other programs end up there, some of which can't or should not be deleted indiscriminately. I'd also suggest that even with the default behavior of placing temp files in system temp, that gradio be changed to instead place them in a gradio sub-directory within that folder. That is what well behaving programs on Windows do to keep their temp files contained and easily identified by end-users, so I think it makes sense. A step further would be adding a built-in option for gradio to automatically clean its temp sub-directory on startup, which would also make sense, since those temp files are never used again by gradio after being killed and relaunched. That alone would resolve primary issue without needing to change the temp directory to a custom location, but custom locations should still be allowed anyway in case the user's system root is low on disk space. |
I don't want to need access to /tmp/ in order for this to work as I don't have it on the current machine |
Yes @Dannypeja you can set the |
For me it would work just to know how a file is hashed, then I can search programatically in the temp folder. How the files is coded? so I can run the same process to know the name of the ffolder. |
Is your feature request related to a problem? Please describe.
The ability to specify where files served by
gr.File
are uploaded would be very useful, right now it's always set to a temporary folder named after the hash of the file and it is not configurablegradio/gradio/components.py
Lines 240 to 241 in 7856382
That would allow cleaning up the temporary files on each startup, currently there's no centralized place in the temporary folder where Gradio stashes its temporary files, they just accumulate over time
It should allow specifying a path outside the system temporary directory also. Of course the path specified should be added to
temp_file_sets
so it's treated as an allowed pathAnd filename collisions would need to be dealt with somehow. Maybe a way for the user to specify an output subdirectory/filepath to the value sent to a
gr.File
output. Or automatically renaming duplicate files. But the current solution of putting each file in a separate hashed folder isn't very useful, they should all be placed in one folder ideally.One more thing I noticed, this hashing scheme also leaves behind a 0-sized temporary file in the created folder, I think it's unintentional - AUTOMATIC1111/stable-diffusion-webui#8752 (comment)
Describe the solution you'd like
Ability to set
Interface.upload_path
to the root folder whereIOComponent.make_temp_copy_if_needed
should dump filesAdditional context
Specific usecase is better articulated by AUTOMATIC1111/stable-diffusion-webui#8752 (comment)
The text was updated successfully, but these errors were encountered: