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

Gradio is unable to fetch a file from the specified path because it is not within the working directory of the Gradio app or it is not a temporary file created by the app. #4118

Closed
1 task done
wzgrx opened this issue May 9, 2023 · 4 comments
Labels
bug Something isn't working pending clarification

Comments

@wzgrx
Copy link

wzgrx commented May 9, 2023

Describe the bug

The image after running is cracked and the preview image cannot be seen

{"error":"HTTPException","detail":"File cannot be fetched: D:/File/fl/2023-05-09/00004-1710112629.png. All files must contained within the Gradio python app working directory, or be a temp file created by the Gradio python app.","body":"","errors":"(403, 'File cannot be fetched: D:/File/fl/2023-05-09/00004-1710112629.png. All files must contained within the Gradio python app working directory, or be a temp file created by the Gradio python app.')"}

Is there an existing issue for this?

  • I have searched the existing issues

Reproduction

96c17a7

Screenshot

Snipaste_2023-05-09_16-23-51

Logs

{"error":"HTTPException","detail":"File cannot be fetched: D:/File/新建文件夹/2023-05-09/00004-1710112629.png. All files must contained within the Gradio python app working directory, or be a temp file created by the Gradio python app.","body":"","errors":"(403, 'File cannot be fetched: D:/File/新建文件夹/2023-05-09/00004-1710112629.png. All files must contained within the Gradio python app working directory, or be a temp file created by the Gradio python app.')"}

System Info

gradio: 3.28.1
Win11
edge

Severity

annoying

@wzgrx wzgrx added the bug Something isn't working label May 9, 2023
@wzgrx
Copy link
Author

wzgrx commented May 9, 2023

In the stable differentiation web ui AUTOMATIC1111/stable-diffusion-webui@879ed54
Problems with the version

@freddyaboulton
Copy link
Collaborator

Hi @wzgrx ! That's intended behavior. There's an allowed_paths argument to gr.Blocks(), e.g. gr.Blocks(allowed_paths=['D:/File/fl/'], that will allow the server to serve apps from directories not created by it.

@wzgrx
Copy link
Author

wzgrx commented May 9, 2023

嗨!这是预期的行为。例如,有一个参数将允许服务器从不是由它创建的目录中提供应用程序。allowed_paths``gr.Blocks()``gr.Blocks(allowed_paths=['D:/File/fl/']

Okay, it has been fixed. Thank you for your reply

@yiya1989
Copy link

yiya1989 commented Jul 1, 2024

now allowed_paths moves to launch

app.queue(max_size=50).launch(
            allowed_paths=["D:/File"],
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending clarification
Projects
None yet
Development

No branches or pull requests

3 participants