gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
33.43k stars 2.53k forks source link

Custom Components dev server not working beause of Local Import #7025

Closed aersam closed 4 months ago

aersam commented 9 months ago

Describe the bug

Hi there

I just tried creating a component, start that dev server and get stuff running. However I cannot open the page in the browser, since it's blocking an import to a local file, which seems to be generated by Gradio:

  window.__GRADIO__CC__ = {"618eac12c5f429bf7bd0d99e13fa7e11": {
            example: () => import("C:/Projects/Playground/SQLGenerator.AI/aceeditor/frontend/Example.svelte"),

            component: () => import("C:/Projects/Playground/SQLGenerator.AI/aceeditor/frontend")
            },

This cannot work, of course, since the Browser will block such requests. Did I setup something wrong?

Have you searched existing issues? 🔎

Reproduction

gradio cc create AceEditor --template SimpleTextbox 
cd .\aceeditor
gradio cc dev

Screenshot

image

Logs

No response

System Info

Gradio Environment Information:
------------------------------
Operating System: Windows
gradio version: 4.13.0
gradio_client version: 0.8.0

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
altair: 5.2.0
fastapi: 0.108.0
ffmpy: 0.3.1
gradio-client==0.8.0 is not installed.
httpx: 0.25.2
huggingface-hub: 0.20.2
importlib-resources: 6.1.1
jinja2: 3.1.2
markupsafe: 2.1.3
matplotlib: 3.8.2
numpy: 1.26.3
orjson: 3.9.10
packaging: 23.2
pandas: 2.1.4
pillow: 10.2.0
pydantic: 2.5.3
pydub: 0.25.1
python-multipart: 0.0.6
pyyaml: 6.0.1
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.9.0
typing-extensions: 4.9.0
uvicorn: 0.25.0
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.

gradio_client dependencies in your environment:

fsspec: 2023.12.2
httpx: 0.25.2
huggingface-hub: 0.20.2
packaging: 23.2
typing-extensions: 4.9.0
websockets: 11.0.3

Severity

I can work around it

freddyaboulton commented 9 months ago

Hi @aersam ! You didn't do anything wrong - I've seen the same problem on windows too. Problem is not present in OSX or Ubuntu.

kingandrewsolomon commented 8 months ago

How did you work around it? I can't seem to get gradio to import my custom component. @aersam

aersam commented 8 months ago

I could not make it work...

arav-agarwal2 commented 7 months ago

Can someone on the poetry team comment on what could cause this issue?

I'm trying to build my first custom component using WSL2, as that's my main development environment, and I am just running into a whole host of errors with it.

I hoped that I could build the component, and then run the server, but after the dev server breaks, I'm unable to launch a standard Gradio app that doesn't have the component at all.

I'm happy to provide deeper repro if needed however the team wants to handle it - but some clarification on what would help would help us help the team out. If you all know, some insight as to what the cause is would be helpful.

freddyaboulton commented 7 months ago

Hi @arav-agarwal2 ! Hard to know what the issue is without the repro steps. Can you please share them?

pngwn commented 5 months ago

@aersam @arav-agarwal2 could someone try this again with the latest version of gradio it may be fixed now but I am struggling with my windows environment.