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

An environment variable for setting allowed_paths and blocked_paths #8704

Closed
cocktailpeanut opened this issue Jul 5, 2024 · 0 comments · Fixed by #8705
Closed

An environment variable for setting allowed_paths and blocked_paths #8704

cocktailpeanut opened this issue Jul 5, 2024 · 0 comments · Fixed by #8705
Labels
enhancement New feature or request

Comments

@cocktailpeanut
Copy link
Contributor

[O] I have searched to see if a similar issue already exists.

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

a lot of AI applications use up a lot of disk space and many users end up using symbolic links (or junctions) to link files (such as model files) to another drive. Note that these actions are not hard coded into the app, but each user takes care of the linking outside of the apps. This means, these apps will break when they link files to a path outside of the gradio app.

The existing solution is for the app to declare allowd_paths when calling launch() so that the specified paths will be allowed despite being outside of the gradio app root.

However, this is not ideal because the user needs to modify the source code to pass the custom allowed_paths array.

Describe the solution you'd like

By supporting GRADIO_ALLOWED_PATHS (also implemented GRADIO_BLOCKED_PATHS for the sake of completeness), the users don't need to touch the code, but simply set the custom GRADIO_ALLOWED_PATHS environment variable.

Additional context

Here are some users struggling with this issue, to show you that this is a real issue butaixianran/Stable-Diffusion-Webui-Civitai-Helper#71

As you can see, the Stable Diffusion Web UI project has already kind of implemented a workaround by utilizing launch flags, but we can't expect every gradio app to implement the custom allowed_paths feature in code. By supporting the environment variable in addition to the existing approach, all apps built with gradio can let the end users easily use files outside of the gradio path if they want, WITHOUT having to touch the code.

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

Successfully merging a pull request may close this issue.

2 participants