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
Lite: Set the home dir path per appId at each runtime #6432
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/b9e76582b7b0168ec4be9b17a6fc629204a1c13b/gradio-4.8.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@b9e76582b7b0168ec4be9b17a6fc629204a1c13b#subdirectory=client/python" |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
5b219d5
to
c498290
Compare
fb89a52
to
ab36333
Compare
Here is an example:
import gradio as gr
def fn():
with open("text.txt") as f:
return f.read()
demo = gr.Interface(fn=fn, inputs=None, outputs="text")
demo.launch()
|
I found this branch is not working because it is originally for v3, but the main is now v4 and it's been merged to this branch, then this branch fails to build. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying @whitphx, tested and lgtm!
Thanks! |
@whitphx What is the status of this PR? Is it waiting on the lite v4 branch? If it isn't currently ready + working can we close it and reopen later? |
@pngwn Will merge it soon |
* Set the home dir path per appId at each runtime * Add a comment * add changeset --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com> Co-authored-by: Ali Abdalla <ali.si3luwa@gmail.com>
Description
Fix the bug introduced in the SharedWorker mode (#6099).
#6099 introduced app-level home dirs (
/home/pyodide/<appId>
) so each app running on a SharedWorker has separated home dir on the file system.However, the current directory is not set properly in the Python environment, so file access methods such as
open()
with relative paths which are assumed to be resolved based on the app-level home dir can fail.This PR fixes it, by calling
os.chdir()
and setting `os.environ["HOME"].