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.63k stars 2.55k forks source link

Error Encountered After Running gradio cc dev for Custom Component #9271

Closed sanidhyy closed 1 month ago

sanidhyy commented 1 month ago

Describe the bug

I was following the Gradio custom component quickstart guide.

When trying to run gradio cc dev, I encountered error when opening the frontend on localhost.

Have you searched existing issues? 🔎

Reproduction

import gradio as gr
from gradio_testcomponent import TestComponent

example = TestComponent().example_value()

demo = gr.Interface(
    lambda x:x,
    TestComponent(),  # interactive version of your component
    TestComponent(),  # static version of your component
    # examples=[[example]],  # uncomment this line to view the "example version" of your component
)

if __name__ == "__main__":
    demo.launch()

Screenshot

image

Logs

No response

System Info

Gradio Environment Information:
------------------------------
Operating System: Windows
gradio version: 4.42.0
gradio_client version: 1.3.0

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

aiofiles: 23.2.1
anyio: 4.4.0
fastapi: 0.112.2
ffmpy: 0.4.0
gradio-client==1.3.0 is not installed.
httpx: 0.27.2
huggingface-hub: 0.24.6
importlib-resources: 6.4.4
jinja2: 3.1.4
markupsafe: 2.1.5
matplotlib: 3.9.2
numpy: 2.1.0
orjson: 3.10.7
packaging: 24.1
pandas: 2.2.2
pillow: 10.4.0
pydantic: 2.8.2
pydub: 0.25.1
python-multipart: 0.0.9
pyyaml: 6.0.2
ruff: 0.6.3
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.12.5
typing-extensions: 4.12.2
urllib3: 2.2.2
uvicorn: 0.30.6
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.

gradio_client dependencies in your environment:

fsspec: 2024.6.1
httpx: 0.27.2
huggingface-hub: 0.24.6
packaging: 24.1
typing-extensions: 4.12.2
websockets: 12.0

Severity

Blocking usage of gradio

freddyaboulton commented 1 month ago

Hi @sanidhyy - can you please run gradio cc dev --python-path <path-to-python-interpreter> It should be the path to the python interpreter where you have installed your custom component.

sanidhyy commented 1 month ago

Thanks @freddyaboulton - It worked for me after running gradio cc dev --python-path <path-to-python-interpreter> --gradio-path <path-to-gradio-executable>.

freddyaboulton commented 1 month ago

Glad it's working @sanidhyy. I think we can improve this development experience in 5.0.