Skip to content

update gr.Dataset gets AttributeError: 'Textbox' object has no attribute 'proxy_url' #6415

Closed
@Billijk

Description

Describe the bug

I tried to update samples of the Dataset component and it failed with the following error:

Traceback (most recent call last):
  File "/data1/conda/agents/lib/python3.9/site-packages/gradio/queueing.py", line 427, in call_prediction
    output = await route_utils.call_process_api(
  File "/data1/conda/agents/lib/python3.9/site-packages/gradio/route_utils.py", line 232, in call_process_api
    output = await app.get_blocks().process_api(
  File "/data1/conda/agents/lib/python3.9/site-packages/gradio/blocks.py", line 1525, in process_api
    result = await self.call_function(
  File "/data1/conda/agents/lib/python3.9/site-packages/gradio/blocks.py", line 1147, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/data1/conda/agents/lib/python3.9/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/data1/conda/agents/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/data1/conda/agents/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/data1/conda/agents/lib/python3.9/site-packages/gradio/utils.py", line 672, in wrapper
    response = f(*args, **kwargs)
  File "/data/codes/test/langchain/server/gradio_test.py", line 21, in change_dataset
    return gr.Dataset(components=["textbox"], visible=False)
  File "/data1/conda/agents/lib/python3.9/site-packages/gradio/component_meta.py", line 152, in wrapper
    return fn(self, **kwargs)
  File "/data1/conda/agents/lib/python3.9/site-packages/gradio/components/dataset.py", line 73, in __init__
    self.component_props = [
  File "/data1/conda/agents/lib/python3.9/site-packages/gradio/components/dataset.py", line 75, in <listcomp>
    component.get_config(),
  File "/data1/conda/agents/lib/python3.9/site-packages/gradio/components/base.py", line 212, in get_config
    config = super().get_config()
  File "/data1/conda/agents/lib/python3.9/site-packages/gradio/blocks.py", line 216, in get_config
    config = {**config, "proxy_url": self.proxy_url, "name": self.get_block_name()}
AttributeError: 'Textbox' object has no attribute 'proxy_url'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/data1/conda/agents/lib/python3.9/site-packages/gradio/queueing.py", line 472, in process_events
    response = await self.call_prediction(awake_events, batch)
  File "/data1/conda/agents/lib/python3.9/site-packages/gradio/queueing.py", line 436, in call_prediction
    raise Exception(str(error) if show_error else None) from error
Exception: 'Textbox' object has no attribute 'proxy_url'

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

I used this code modified from the Updating Component Configurations example to reproduce.

import gradio as gr

def change_dataset(choice):
    if choice == "short":
        return gr.Dataset(components=["textbox"], samples=[["1", "2"]])
    elif choice == "long":
        return gr.Dataset(components=["textbox"], samples=[["1", "2", "3", "4", "5", "6", "7", "8"]])
    else:
        return gr.Dataset(components=["textbox"], visible=False)

with gr.Blocks() as demo:

    radio = gr.Radio(
        ["short", "long", "none"], label="What kind of essay would you like to write?"
    )
    dataset = gr.Dataset(label="essay", components=["textbox"], samples=[[""]], samples_per_page=15)
    radio.change(fn=change_dataset, inputs=radio, outputs=dataset)

demo.launch()

Screenshot

No response

Logs

No response

System Info

Gradio Environment Information:
------------------------------
Operating System: Linux
gradio version: 4.3.0
gradio_client version: 0.7.0

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

aiofiles: 23.2.1
altair: 5.0.1
fastapi: 0.101.1
ffmpy: 0.3.1
gradio-client==0.7.0 is not installed.
httpx: 0.24.1
huggingface-hub: 0.16.4
importlib-resources: 6.1.0
jinja2: 3.1.2
markupsafe: 2.1.3
matplotlib: 3.3.4
numpy: 1.19.5
orjson: 3.9.5
packaging: 23.0
pandas: 1.1.5
pillow: 8.4.0
pydantic: 2.4.2
pydub: 0.25.1
python-multipart: 0.0.6
pyyaml: 6.0.1
requests: 2.26.0
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.9.0
typing-extensions: 4.7.1
uvicorn: 0.23.2
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.


gradio_client dependencies in your environment:

fsspec: 2023.6.0
httpx: 0.24.1
huggingface-hub: 0.16.4
packaging: 23.0
requests: 2.26.0
typing-extensions: 4.7.1
websockets: 11.0.3

Severity

Blocking usage of gradio

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions