Skip to content
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

Cannot load an interface with a load event attached as of gradio 3.50.2 #6072

Closed
1 task done
freddyaboulton opened this issue Oct 24, 2023 · 1 comment
Closed
1 task done
Labels
bug Something isn't working

Comments

@freddyaboulton
Copy link
Collaborator

Describe the bug

If you try to load an interface with a load event using gr.load, it will error.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

df = gr.load("gradio-tests/dataframe_load", src="spaces")

Screenshot

No response

Logs

KeyError                                  Traceback (most recent call last)
Cell In[2], line 1
----> 1 df = gr.load("gradio-tests/dataframe_load", src="spaces")

File ~/miniconda3/envs/blank/lib/python3.10/site-packages/gradio/external.py:70, in load(name, src, api_key, hf_token, alias, **kwargs)
     65     warn_deprecation(
     66         "The `api_key` parameter will be deprecated. "
     67         "Please use the `hf_token` parameter going forward."
     68     )
     69     hf_token = api_key
---> 70 return load_blocks_from_repo(
     71     name=name, src=src, hf_token=hf_token, alias=alias, **kwargs
     72 )

File ~/miniconda3/envs/blank/lib/python3.10/site-packages/gradio/external.py:109, in load_blocks_from_repo(name, src, hf_token, alias, **kwargs)
    104         warnings.warn(
    105             """You are loading a model/Space with a different access token than the one you used to load a previous model/Space. This is not recommended, as it may cause unexpected behavior."""
    106         )
    107     Context.hf_token = hf_token
--> 109 blocks: gradio.Blocks = factory_methods[src](name, hf_token, alias, **kwargs)
    110 return blocks

File ~/miniconda3/envs/blank/lib/python3.10/site-packages/gradio/external.py:505, in from_spaces(space_name, hf_token, alias, **kwargs)
    498 if kwargs:
    499     warnings.warn(
    500         "You cannot override parameters for this Space by passing in kwargs. "
    501         "Instead, please load the Space as a function and use it to create a "
    502         "Blocks or Interface locally. You may find this Guide helpful: "
    503         "https://gradio.app/using_blocks_like_functions/"
    504     )
--> 505 return from_spaces_blocks(space=space_name, hf_token=hf_token)

File ~/miniconda3/envs/blank/lib/python3.10/site-packages/gradio/external.py:511, in from_spaces_blocks(space, hf_token)
    509 client = Client(space, hf_token=hf_token)
    510 predict_fns = [endpoint._predict_resolve for endpoint in client.endpoints]
--> 511 return gradio.Blocks.from_config(client.config, predict_fns, client.src)

File ~/miniconda3/envs/blank/lib/python3.10/site-packages/gradio/blocks.py:793, in Blocks.from_config(cls, config, fns, root_url)
    791 _targets = dependency.pop("targets")
    792 trigger = dependency.pop("trigger", None)
--> 793 targets = [
    794     getattr(
    795         original_mapping[
    796             target if isinstance(target, int) else target[0]
    797         ],
    798         trigger if isinstance(target, int) else target[1],
    799     )
    800     for target in _targets
    801 ]
    802 dependency.pop("backend_fn")
    803 dependency.pop("documentation", None)

File ~/miniconda3/envs/blank/lib/python3.10/site-packages/gradio/blocks.py:795, in <listcomp>(.0)
    791 _targets = dependency.pop("targets")
    792 trigger = dependency.pop("trigger", None)
    793 targets = [
    794     getattr(
--> 795         original_mapping[
    796             target if isinstance(target, int) else target[0]
    797         ],
    798         trigger if isinstance(target, int) else target[1],
    799     )
    800     for target in _targets
    801 ]
    802 dependency.pop("backend_fn")
    803 dependency.pop("documentation", None)

KeyError: None

System Info

Gradio Environment Information:
------------------------------
Operating System: Darwin
gradio version: 3.50.2
gradio_client version: 0.6.1

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

aiofiles: 23.2.1
altair: 5.1.2
fastapi: 0.103.2
ffmpy: 0.3.1
gradio-client==0.6.1 is not installed.
httpx: 0.25.0
huggingface-hub: 0.18.0
importlib-resources: 6.1.0
jinja2: 3.1.2
markupsafe: 2.1.3
matplotlib: 3.8.0
numpy: 1.26.1
orjson: 3.9.9
packaging: 23.2
pandas: 2.1.1
pillow: 10.1.0
pydantic: 1.10.13
pydub: 0.25.1
python-multipart: 0.0.6
pyyaml: 6.0.1
requests: 2.31.0
semantic-version: 2.10.0
typing-extensions: 4.8.0
uvicorn: 0.23.2
websockets: 11.0.3
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.


gradio_client dependencies in your environment:

fsspec: 2023.9.2
httpx: 0.25.0
huggingface-hub: 0.18.0
packaging: 23.2
requests: 2.31.0
typing-extensions: 4.8.0
websockets: 11.0.3

Severity

I can work around it

@freddyaboulton
Copy link
Collaborator Author

Not an issue on 5.0

@freddyaboulton freddyaboulton closed this as not planned Won't fix, can't repro, duplicate, stale Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants