gradio: Custom Components Guide does not seem to lead to a working example

Describe the bug

I tried following the guide at https://www.gradio.app/guides/custom-components-in-five-minutes.

I didn’t make any code-changes yet, so I’m expecting to see my new component as a SimpleTextbox.

However when I go to the frontend URL I only see a screen with an infinite “Loading” text. The console shows these errors:

Uncaught SyntaxError: Unexpected token '{' (at (index):55:35)

svelte.js:3232 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '$$')
    at init (svelte.js:3232:44)
    at new Blocks (Blocks.svelte:669:31)
    at Array.create_if_block_1 (index.svelte:184:43)
    at Object.p (Index.svelte:394:41)
    at update_slot_base (svelte.js:203:8)
    at Object.p (core.js:231:1)
    at update (svelte.js:2128:30)
    at flush (svelte.js:2088:5)

Line 55 at index looks like this:

<script>window.gradio_config = {{ config | toorjson }};</script>

Is this a bug? Am I missing a step?

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

Follow the guide until you enter the frontend URL.

Screenshot

No response

Logs

No response

System Info

Gradio Environment Information:
------------------------------
Operating System: Windows
gradio version: 4.10.0
gradio_client version: 0.7.3

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

aiofiles: 23.2.1
altair: 5.2.0
fastapi: 0.105.0
ffmpy: 0.3.1
gradio-client==0.7.3 is not installed.
httpx: 0.24.1
huggingface-hub: 0.19.4
importlib-resources: 6.1.1
jinja2: 3.1.2
markupsafe: 2.1.3
matplotlib: 3.8.2
numpy: 1.23.5
orjson: 3.9.10
packaging: 23.2
pandas: 2.1.4
pillow: 9.5.0
pydantic: 2.5.2
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.8.0
uvicorn: 0.24.0.post1
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.


gradio_client dependencies in your environment:

fsspec: 2023.12.1
httpx: 0.24.1
huggingface-hub: 0.19.4
packaging: 23.2
typing-extensions: 4.8.0
websockets: 11.0.3

Severity

Blocking usage of gradio

About this issue

  • Original URL
  • State: open
  • Created 6 months ago
  • Reactions: 1
  • Comments: 27

Most upvoted comments

Yea they look like separate issues. In @AlUlkesh 's case, we can find the source code of the custom component but we can’t load it for some reason. In your case, we couldn’t find the source code (that’s what __GRADIO_CC__ being empty means). Still looking into it 😅

Well, I first was on:

node  v21.4.0
npm   10.2.4

but I since downgraded node due to your suggestion, so now it looks like this:

node  v18.17.0
npm   9.6.7

Are both of you on windows @Ethan-yt and @AlUlkesh ?

I am on macOS. Same problem, stuck on loading. But when I change another macbook everything works fine…