-
Notifications
You must be signed in to change notification settings - Fork 91
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
Simple Gradio sample crashes after loading #5459
Comments
I opened an issue gradio-app/gradio#10093 and a PR gradio-app/gradio#10094 in Gradio to allow Copying over the issue description here for reference: Gradio Issue 10093Describe the bugHTTP Code MDN Docs for the mentioned HTTP codes:
Although Currently, ReproductionExample App for ReproThis app should be run in Positron with the Run App feature, which creates a proxy for the app and displays the proxied url in the viewer. import gradio as gr
def image_classifier(inp):
return {'cat': 0.3, 'dog': 0.7}
demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label")
demo.launch() The app runs successfully, but crashes immediately after starting up with: Traceback (most recent call last):
File "/Users/sashimi/Documents/projects/my-python-project_gradio/gradio_example.py", line 5, in <module>
demo.launch()
File "/Users/sashimi/Documents/projects/my-python-project_gradio/.venv/lib/python3.12/site-packages/gradio/blocks.py", line 2590, in launch
raise ValueError(
ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True or check your proxy settings to allow access to localhost. Adding Traceback (most recent call last):
File "/Users/sashimi/Documents/projects/my-python-project_gradio/gradio_example.py", line 5, in <module>
demo.launch()
File "/Users/sashimi/Documents/projects/my-python-project_gradio/.venv/lib/python3.12/site-packages/gradio/blocks.py", line 2590, in launch
raise ValueError(
ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True or check your proxy settings to allow access to localhost. LogsModified
Output
System InfoGradio Environment Information:
------------------------------
Operating System: Darwin
gradio version: 5.7.1
gradio_client version: 1.5.0
------------------------------------------------
gradio dependencies in your environment:
aiofiles: 23.2.1
anyio: 4.6.2.post1
audioop-lts is not installed.
fastapi: 0.115.5
ffmpy: 0.4.0
gradio-client==1.5.0 is not installed.
httpx: 0.28.0
huggingface-hub: 0.26.3
jinja2: 3.1.4
markupsafe: 2.1.5
numpy: 2.1.3
orjson: 3.10.12
packaging: 24.2
pandas: 2.2.3
pillow: 11.0.0
pydantic: 2.10.2
pydub: 0.25.1
python-multipart==0.0.12 is not installed.
pyyaml: 6.0.2
ruff: 0.8.1
safehttpx: 0.1.1
semantic-version: 2.10.0
starlette: 0.41.3
tomlkit==0.12.0 is not installed.
typer: 0.14.0
typing-extensions: 4.12.2
urllib3: 2.2.3
uvicorn: 0.32.1
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.
gradio_client dependencies in your environment:
fsspec: 2024.10.0
httpx: 0.28.0
huggingface-hub: 0.26.3
packaging: 24.2
typing-extensions: 4.12.2
websockets: 12.0 After making the fix locally, I'm seeing a separate issue in Positron Web where some .css files are not being loaded from the right path: css.ts:29 Unable to preload CSS for http://localhost:8080/assets/index-Bmd1Nf3q.css
(anonymous) @ css.ts:29
error
(anonymous) @ css.ts:28
Wt @ css.ts:26
connectedCallback @ main.ts:95
await in connectedCallback
ju @ main.ts:207
(anonymous) @ main.ts:210Understand this errorAI
css.ts:29 Unable to preload CSS for http://127.0.0.1:7860/proxy/53806/theme.css?v=76ee63afdb6c2791ddf9b92428cb796885031b4a4f1259df434def0a7c3f9d63 I feel like this might be related to gradio-app/gradio#9101 / gradio-app/gradio#9822. |
Yeah, looks like gradio-app/gradio#9822 is causing the relative CSS paths to be used instead of an absolute path, which we rely on. I reverted the change in gradio-app/gradio#9822 by modifying the minified JS in the gradio libary in my venv and the CSS loads from the correct absolute path. |
Opened PR: #5590, but keeping it as a draft, as we'll need to wait on the release of |
Just so I am clear, does this mean that Positron will work with newer versions of gradio but will not work with older versions of gradio? |
Yes sort of -- previously it was somewhat undefined which versions of Gradio would work with Run App. We were experiencing a version of gradio-app/gradio#9529, so I tested Run App with this combination of versions Now, we've seen other versions of Gradio failing, e.g. Chris saw the failure in the issue description with Gradio 5.6.0 recently, so it's not clear which versions of Gradio were working. |
### Summary - Addresses #5459 - Companion Gradio Issue gradio-app/gradio#10093 - Companion Gradio PR gradio-app/gradio#10094 - Re-enables `Python - Verify Basic Gradio App [C903307]` #### localhost ValueError gradio-app/gradio#10094 addresses the following error described in #5459 ``` Traceback (most recent call last): File "/Users/christophermead/posit/qa-example-content/workspaces/python_apps/gradio_example/gradio_example.py", line 5, in <module> demo.launch() File "/Users/christophermead/.pyenv/versions/3.10.12/lib/python3.10/site-packages/gradio/blocks.py", line 2582, in launch raise ValueError( ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True or check your proxy settings to allow access to localhost. ``` We'll need to wait for [Gradio 5.8.0](gradio-app/gradio#10082) before we can confirm that this error is fixed -- **edit: 5.8.0 has been released**! This error occurs before the [CSS styling issue](#5459 (comment)) can be seen. A manual patch to gradio is currently needed in order to reach this second issue. #### Failure to load styles Our use of `GRADIO_ROOT_PATH` is no longer needed and also no longer works since the underlying issue was resolved in [Gradio 5.7.0](gradio-app/gradio#9970), via gradio-app/gradio#9822. The related code is being removed in this PR. ### QA Notes The [gradio example app](https://github.com/posit-dev/qa-example-content/tree/main/workspaces/python_apps/gradio_example) should now work in Web and Desktop.
Verified Fixed
Test scenario(s)Gradio app no longer crashing locally or in CI. Tested with newest and second newest gradio versions as of today. Link(s) to TestRail test cases run or created: |
System details:
Positron and OS details:
Positron Version: 2024.12.0 (Universal) build 41
OSX
Interpreter details:
Python 3.10.12
Describe the issue:
This simple Gradio sample no longer stays running:
It dies with:
Steps to reproduce the issue:
Expected or desired behavior:
Gradio continues to run.
Were there any error messages in the UI, Output panel, or Developer Tools console?
Did not see any
The text was updated successfully, but these errors were encountered: