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

Removing .update and get_config, attempt 2 #5240

Merged
merged 79 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
853b354
changes
aliabid94 Aug 15, 2023
7745823
add changeset
gradio-pr-bot Aug 15, 2023
3d9bb9b
changes
aliabid94 Aug 15, 2023
e6aeba1
Merge branch 'update_attempt_2' of https://github.com/gradio-app/grad…
aliabid94 Aug 15, 2023
0a512ae
changes
aliabid94 Aug 16, 2023
ec95e4b
Update many-tips-create.md
aliabid94 Aug 16, 2023
6f52f81
Merge branch 'main' into update_attempt_2
abidlabs Aug 16, 2023
9f0a42c
notebooks
abidlabs Aug 16, 2023
967cbdc
chanegs
aliabid94 Aug 16, 2023
e0a8fb7
changes
aliabid94 Aug 16, 2023
2158698
changes
aliabid94 Aug 17, 2023
904eebd
changes
aliabid94 Aug 18, 2023
0d011bd
changes
aliabid94 Aug 18, 2023
9911390
changes
aliabid94 Aug 18, 2023
33f5922
changes
aliabid94 Aug 19, 2023
2d4b9ad
changes
aliabid94 Aug 19, 2023
f92523b
changes
aliabid94 Aug 19, 2023
3f1b544
changes
aliabid94 Aug 19, 2023
e81cc48
Merge branch 'main' into update_attempt_2
aliabid94 Aug 19, 2023
42b1f28
changes
aliabid94 Aug 25, 2023
559079d
changes
aliabid94 Aug 29, 2023
715c21a
changes
aliabid94 Aug 29, 2023
d3fdf6d
changes
aliabid94 Aug 29, 2023
f3f182c
changew
aliabid94 Aug 29, 2023
ac3aa0c
changes
aliabid94 Aug 30, 2023
036c8f5
changes
aliabid94 Aug 30, 2023
113bc7c
changes
aliabid94 Aug 30, 2023
a892bcd
changes
aliabid94 Aug 30, 2023
a282042
changes
aliabid94 Aug 30, 2023
01db73f
chanegs
aliabid94 Aug 30, 2023
0f2aefa
Merge remote-tracking branch 'origin' into update_attempt_2
aliabid94 Aug 30, 2023
0159898
changes
aliabid94 Sep 1, 2023
06a2027
changes
aliabid94 Sep 5, 2023
df7f322
changes
aliabid94 Sep 5, 2023
fd040e9
changes
aliabid94 Sep 5, 2023
c2ba111
changes
aliabid94 Sep 5, 2023
af00a1e
changes
aliabid94 Sep 6, 2023
2feda23
changes
aliabid94 Sep 6, 2023
2db78d0
changes
aliabid94 Sep 6, 2023
5426e9e
Merge remote-tracking branch 'origin' into update_attempt_2
aliabid94 Sep 8, 2023
bf37be4
Merge remote-tracking branch 'origin' into update_attempt_2
aliabid94 Sep 8, 2023
8061297
changes
aliabid94 Sep 8, 2023
ea73321
changes
aliabid94 Sep 8, 2023
ee2e2f5
changes
aliabid94 Sep 8, 2023
02bfde4
changes
aliabid94 Sep 8, 2023
d00dacd
changes
aliabid94 Sep 8, 2023
d36607d
Merge remote-tracking branch 'origin' into update_attempt_2
aliabid94 Sep 11, 2023
81fe76a
changes
aliabid94 Sep 11, 2023
0feb9de
changes
aliabid94 Sep 11, 2023
82c9405
Merge remote-tracking branch 'origin' into update_attempt_2
aliabid94 Sep 11, 2023
0868c25
changes
aliabid94 Sep 11, 2023
b5c50fc
Revert "changes"
aliabid94 Sep 11, 2023
9a52f9c
changes
aliabid94 Sep 11, 2023
08f7baa
changes
aliabid94 Sep 11, 2023
1f4d71b
changes
aliabid94 Sep 11, 2023
4c15cca
changes
aliabid94 Sep 11, 2023
efaddcc
changes
aliabid94 Sep 11, 2023
616f9d1
changes
aliabid94 Sep 11, 2023
c210d37
change
aliabid94 Sep 12, 2023
58075aa
changes
aliabid94 Sep 13, 2023
d2909aa
Merge remote-tracking branch 'origin' into update_attempt_2
aliabid94 Sep 14, 2023
b6486c4
changes
aliabid94 Sep 14, 2023
aa617d8
chaneges
aliabid94 Sep 14, 2023
d3317cf
Merge branch 'main' into update_attempt_2
aliabd Sep 14, 2023
ab40a47
Merge remote-tracking branch 'origin/main' into update_attempt_2
aliabid94 Sep 15, 2023
a15058c
changes
aliabid94 Sep 15, 2023
3b58172
chagnes
aliabid94 Sep 15, 2023
b0a3575
changes
aliabid94 Sep 16, 2023
46bf1a9
changes
aliabid94 Sep 18, 2023
f3b284e
changes
aliabid94 Sep 18, 2023
8cf05d9
changes
aliabid94 Sep 18, 2023
b0b55c8
changes
aliabid94 Sep 18, 2023
1fc8b24
changes
aliabid94 Sep 18, 2023
1dac13c
Merge branch 'main' into update_attempt_2
abidlabs Sep 18, 2023
e69b833
fix typing
abidlabs Sep 19, 2023
e552936
changes
aliabid94 Sep 19, 2023
5811531
Merge branch 'update_attempt_2' of https://github.com/gradio-app/grad…
aliabid94 Sep 19, 2023
1a4048d
Merge branch 'main' into update_attempt_2
abidlabs Sep 19, 2023
0a3d751
Merge branch 'main' into update_attempt_2
abidlabs Sep 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/many-tips-create.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to make the changeset thing support multiline comments for fix + feat. I'll do that tomorrow, should be quick.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"gradio": minor
---

feat:Cleanup of .update and .get_config per component

get_config is removed, the config used is simply any attribute that is in the Block that shares a name with one of the constructor paramaters.

update is not removed for backwards compatibility, but deprecated. Instead return the component itself. Created a updateable decorator that simply checks to see if we're in an update, and if so, skips the constructor and wraps the args and kwargs in an update dictionary. easy peasy.
2 changes: 1 addition & 1 deletion demo/blocks_essay/run.ipynb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: blocks_essay"]}, {"cell_type": "code", "execution_count": null, "id": 272996653310673477252411125948039410165, "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": 288918539441861185822528903084949547379, "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "\n", "def change_textbox(choice):\n", " if choice == \"short\":\n", " return gr.Textbox.update(lines=2, visible=True)\n", " elif choice == \"long\":\n", " return gr.Textbox.update(lines=8, visible=True)\n", " else:\n", " return gr.Textbox.update(visible=False)\n", "\n", "\n", "with gr.Blocks() as demo:\n", " radio = gr.Radio(\n", " [\"short\", \"long\", \"none\"], label=\"What kind of essay would you like to write?\"\n", " )\n", " text = gr.Textbox(lines=2, interactive=True).style(show_copy_button=True)\n", "\n", " radio.change(fn=change_textbox, inputs=radio, outputs=text)\n", "\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
{"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: blocks_essay"]}, {"cell_type": "code", "execution_count": null, "id": 272996653310673477252411125948039410165, "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": 288918539441861185822528903084949547379, "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "\n", "def change_textbox(choice):\n", " if choice == \"short\":\n", " return gr.Textbox(lines=2, visible=True)\n", " elif choice == \"long\":\n", " return gr.Textbox(lines=8, visible=True, value=\"Lorem ipsum dolor sit amet\")\n", " else:\n", " return gr.Textbox(visible=False)\n", "\n", "\n", "with gr.Blocks() as demo:\n", " radio = gr.Radio(\n", " [\"short\", \"long\", \"none\"], label=\"What kind of essay would you like to write?\"\n", " )\n", " text = gr.Textbox(lines=2, interactive=True, show_copy_button=True)\n", " radio.change(fn=change_textbox, inputs=radio, outputs=text)\n", "\n", " with gr.Row():\n", " num = gr.Number(minimum=0, maximum=100, label=\"input\")\n", " out = gr.Number(label=\"output\")\n", " min = gr.Slider(0, 100, 0, label=\"min\")\n", " max = gr.Slider(0, 100, 100, label=\"max\")\n", "\n", " def reset_bounds(min, max):\n", " return gr.Number(minimum=min, maximum=max)\n", " \n", " min.change(reset_bounds, [min, max], outputs=num)\n", " max.change(reset_bounds, [min, max], outputs=num)\n", " num.submit(lambda x:x, num, out)\n", "\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
22 changes: 17 additions & 5 deletions demo/blocks_essay/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,33 @@

def change_textbox(choice):
if choice == "short":
return gr.Textbox.update(lines=2, visible=True)
return gr.Textbox(lines=2, visible=True)
elif choice == "long":
return gr.Textbox.update(lines=8, visible=True)
return gr.Textbox(lines=8, visible=True, value="Lorem ipsum dolor sit amet")
else:
return gr.Textbox.update(visible=False)
return gr.Textbox(visible=False)


with gr.Blocks() as demo:
radio = gr.Radio(
["short", "long", "none"], label="What kind of essay would you like to write?"
)
text = gr.Textbox(lines=2, interactive=True).style(show_copy_button=True)

text = gr.Textbox(lines=2, interactive=True, show_copy_button=True)
radio.change(fn=change_textbox, inputs=radio, outputs=text)

with gr.Row():
num = gr.Number(minimum=0, maximum=100, label="input")
out = gr.Number(label="output")
min = gr.Slider(0, 100, 0, label="min")
max = gr.Slider(0, 100, 100, label="max")

def reset_bounds(min, max):
return gr.Number(minimum=min, maximum=max)

min.change(reset_bounds, [min, max], outputs=num)
max.change(reset_bounds, [min, max], outputs=num)
num.submit(lambda x:x, num, out)


if __name__ == "__main__":
demo.launch()
2 changes: 1 addition & 1 deletion demo/chatbot_multimodal/run.ipynb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: chatbot_multimodal"]}, {"cell_type": "code", "execution_count": null, "id": 272996653310673477252411125948039410165, "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": 288918539441861185822528903084949547379, "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import random\n", "import time\n", "\n", "# Chatbot demo with multimodal input (text, markdown, LaTeX, code blocks, image, audio, & video). Plus shows support for streaming text.\n", "\n", "def add_text(history, text):\n", " history = history + [(text, None)]\n", " return history, gr.update(value=\"\", interactive=False)\n", "\n", "\n", "def add_file(history, file):\n", " history = history + [((file.name,), None)]\n", " return history\n", "\n", "\n", "def bot(history):\n", " response = \"**That's cool!**\"\n", " history[-1][1] = \"\"\n", " for character in response:\n", " history[-1][1] += character\n", " time.sleep(0.05)\n", " yield history\n", "\n", "\n", "with gr.Blocks() as demo:\n", " chatbot = gr.Chatbot([], elem_id=\"chatbot\").style(height=750)\n", "\n", " with gr.Row():\n", " with gr.Column(scale=0.85):\n", " txt = gr.Textbox(\n", " show_label=False,\n", " placeholder=\"Enter text and press enter, or upload an image\",\n", " ).style(container=False)\n", " with gr.Column(scale=0.15, min_width=0):\n", " btn = gr.UploadButton(\"\ud83d\udcc1\", file_types=[\"image\", \"video\", \"audio\"])\n", "\n", " txt_msg = txt.submit(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(\n", " bot, chatbot, chatbot\n", " )\n", " txt_msg.then(lambda: gr.update(interactive=True), None, [txt], queue=False)\n", " file_msg = btn.upload(add_file, [chatbot, btn], [chatbot], queue=False).then(\n", " bot, chatbot, chatbot\n", " )\n", "\n", "demo.queue()\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
{"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: chatbot_multimodal"]}, {"cell_type": "code", "execution_count": null, "id": 272996653310673477252411125948039410165, "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": 288918539441861185822528903084949547379, "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import random\n", "import time\n", "\n", "# Chatbot demo with multimodal input (text, markdown, LaTeX, code blocks, image, audio, & video). Plus shows support for streaming text.\n", "\n", "def add_text(history, text):\n", " history = history + [(text, None)]\n", " return history, gr.update(value=\"\", interactive=False)\n", "\n", "\n", "def add_file(history, file):\n", " history = history + [((file.name,), None)]\n", " return history\n", "\n", "\n", "def bot(history):\n", " response = \"**That's cool!**\"\n", " history[-1][1] = \"\"\n", " for character in response:\n", " history[-1][1] += character\n", " time.sleep(0.05)\n", " yield history\n", "\n", "\n", "with gr.Blocks() as demo:\n", " chatbot = gr.Chatbot([], elem_id=\"chatbot\", height=750)\n", "\n", " with gr.Row():\n", " with gr.Column(scale=0.85):\n", " txt = gr.Textbox(\n", " show_label=False,\n", " placeholder=\"Enter text and press enter, or upload an image\",\n", " container=False)\n", " with gr.Column(scale=0.15, min_width=0):\n", " btn = gr.UploadButton(\"\ud83d\udcc1\", file_types=[\"image\", \"video\", \"audio\"])\n", "\n", " txt_msg = txt.submit(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(\n", " bot, chatbot, chatbot\n", " )\n", " txt_msg.then(lambda: gr.update(interactive=True), None, [txt], queue=False)\n", " file_msg = btn.upload(add_file, [chatbot, btn], [chatbot], queue=False).then(\n", " bot, chatbot, chatbot\n", " )\n", "\n", "demo.queue()\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
47 changes: 41 additions & 6 deletions gradio/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import webbrowser
from abc import abstractmethod
from collections import defaultdict
from functools import wraps
from pathlib import Path
from types import ModuleType
from typing import TYPE_CHECKING, Any, AsyncIterator, Callable, Literal, cast
Expand Down Expand Up @@ -89,6 +90,26 @@
}


def updateable(fn):
@wraps(fn)
def wrapper(*args, **kwargs):
if is_update():
fn_args = inspect.getfullargspec(fn).args
self = args[0]
for i, arg in enumerate(args):
if i == 0: # skip self
continue
arg_name = fn_args[i]
kwargs[arg_name] = arg
kwargs["__type__"] = "update"
self.update_config = kwargs
return None
else:
return fn(*args, **kwargs)

return wrapper


class Block:
def __init__(
self,
Expand All @@ -113,11 +134,16 @@ def __init__(
self._skip_init_processing = _skip_init_processing
self.parent: BlockContext | None = None
self.is_rendered: bool = False
self.update_config: dict

if render:
self.render()
check_deprecated_parameters(self.__class__.__name__, kwargs=kwargs)

def __new__(cls, *args, **kwargs):
cls.__init__ = updateable(cls.__init__)
return super().__new__(cls)

def render(self):
"""
Adds self into appropriate BlockContext
Expand Down Expand Up @@ -307,12 +333,13 @@ def set_event_trigger(
return dependency, len(Context.root_block.dependencies) - 1

def get_config(self):
return {
"visible": self.visible,
"elem_id": self.elem_id,
"elem_classes": self.elem_classes,
"root_url": self.root_url,
}
config = {}
signature = inspect.signature(self.__class__.__init__)
for parameter in signature.parameters.values():
if hasattr(self, parameter.name):
value = getattr(self, parameter.name)
config[parameter.name] = value
return {**config, "root_url": self.root_url, "name": self.get_block_name()}

@staticmethod
@abstractmethod
Expand Down Expand Up @@ -1327,6 +1354,8 @@ def postprocess_data(
output.append(None)
else:
prediction_value = predictions[i]
if isinstance(prediction_value, Block):
prediction_value = prediction_value.update_config
if utils.is_update(prediction_value):
assert isinstance(prediction_value, dict)
prediction_value = postprocess_update_dict(
Expand Down Expand Up @@ -2241,3 +2270,9 @@ def queue_enabled_for_fn(self, fn_index: int):
if self.dependencies[fn_index]["queue"] is None:
return self.enable_queue
return self.dependencies[fn_index]["queue"]


def is_update():
from gradio import context

return hasattr(context.thread_data, "blocks")
11 changes: 0 additions & 11 deletions gradio/components/annotated_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,6 @@ def __init__(
**kwargs,
)

def get_config(self):
return {
"show_legend": self.show_legend,
"value": self.value,
"height": self.height,
"width": self.width,
"color_map": self.color_map,
"selectable": self.selectable,
**IOComponent.get_config(self),
}

@staticmethod
def update(
value: tuple[
Expand Down
12 changes: 0 additions & 12 deletions gradio/components/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,6 @@ def __init__(
)
TokenInterpretable.__init__(self)

def get_config(self):
return {
"source": self.source,
"value": self.value,
"streaming": self.streaming,
"autoplay": self.autoplay,
"show_download_button": self.show_download_button,
"show_share_button": self.show_share_button,
"show_edit_button": self.show_edit_button,
**IOComponent.get_config(self),
}

def example_inputs(self) -> dict[str, Any]:
return {
"raw": {"is_file": False, "data": media_data.BASE64_AUDIO},
Expand Down
5 changes: 0 additions & 5 deletions gradio/components/bar_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,6 @@ def __init__(
every=every,
)

def get_config(self):
config = super().get_config()
config["caption"] = self.caption
return config

def get_block_name(self) -> str:
return "plot"

Expand Down
23 changes: 0 additions & 23 deletions gradio/components/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,6 @@ def __str__(self):
def __repr__(self):
return f"{self.get_block_name()}"

def get_config(self):
"""
:return: a dictionary with context variables for the javascript file associated with the context
"""
return {
"name": self.get_block_name(),
**super().get_config(),
}

def preprocess(self, x: Any) -> Any:
"""
Any preprocessing needed to be performed on function input.
Expand Down Expand Up @@ -335,20 +326,6 @@ def file_bytes_to_file(self, data: bytes, dir: str, file_name: str):
path.write_bytes(data)
return path

def get_config(self):
config = {
"label": self.label,
"show_label": self.show_label,
"container": self.container,
"scale": self.scale,
"min_width": self.min_width,
"interactive": self.interactive,
**super().get_config(),
}
if self.info:
config["info"] = self.info
return config

@staticmethod
def get_load_fn_and_initial_value(value):
if callable(value):
Expand Down
15 changes: 1 addition & 14 deletions gradio/components/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from gradio_client.documentation import document, set_documentation_group
from gradio_client.serializing import StringSerializable

from gradio.components.base import Component, IOComponent, _Keywords
from gradio.components.base import IOComponent, _Keywords
from gradio.deprecation import warn_deprecation, warn_style_method_deprecation
from gradio.events import Clickable

Expand Down Expand Up @@ -75,19 +75,6 @@ def __init__(

self.link = link

def get_config(self):
return {
"value": self.value,
"variant": self.variant,
"size": self.size,
"icon": self.icon,
"link": self.link,
"interactive": self.interactive,
"scale": self.scale,
"min_width": self.min_width,
**Component.get_config(self),
}

@staticmethod
def update(
value: str | Literal[_Keywords.NO_VALUE] | None = _Keywords.NO_VALUE,
Expand Down
12 changes: 0 additions & 12 deletions gradio/components/chatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,6 @@ def __init__(
**kwargs,
)

def get_config(self):
return {
"value": self.value,
"latex_delimiters": self.latex_delimiters,
"selectable": self.selectable,
"height": self.height,
"show_share_button": self.show_share_button,
"rtl": self.rtl,
"show_copy_button": self.show_copy_button,
**IOComponent.get_config(self),
}

@staticmethod
def update(
value: list[list[str | tuple[str] | tuple[str, str] | None]]
Expand Down
6 changes: 0 additions & 6 deletions gradio/components/checkbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ def __init__(
)
NeighborInterpretable.__init__(self)

def get_config(self):
return {
"value": self.value,
**IOComponent.get_config(self),
}

@staticmethod
def update(
value: bool | Literal[_Keywords.NO_VALUE] | None = _Keywords.NO_VALUE,
Expand Down
7 changes: 0 additions & 7 deletions gradio/components/checkboxgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,6 @@ def __init__(
)
NeighborInterpretable.__init__(self)

def get_config(self):
return {
"choices": self.choices,
"value": self.value,
**IOComponent.get_config(self),
}

def example_inputs(self) -> dict[str, Any]:
return {
"raw": self.choices[0] if self.choices else None,
Expand Down
8 changes: 0 additions & 8 deletions gradio/components/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,6 @@ def __init__(
**kwargs,
)

def get_config(self):
return {
"value": self.value,
"language": self.language,
"lines": self.lines,
**IOComponent.get_config(self),
}

def postprocess(self, y):
if y is None:
return None
Expand Down
6 changes: 0 additions & 6 deletions gradio/components/color_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ def example_inputs(self) -> dict[str, Any]:
"serialized": "#000000",
}

def get_config(self):
return {
"value": self.value,
**IOComponent.get_config(self),
}

@staticmethod
def update(
value: str | Literal[_Keywords.NO_VALUE] | None = _Keywords.NO_VALUE,
Expand Down
14 changes: 0 additions & 14 deletions gradio/components/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,20 +148,6 @@ def __init__(
**kwargs,
)

def get_config(self):
return {
"headers": self.headers,
"datatype": self.datatype,
"row_count": self.row_count,
"col_count": self.col_count,
"value": self.value,
"max_rows": self.max_rows,
"max_cols": self.max_cols,
"overflow_row_behaviour": self.overflow_row_behaviour,
"wrap": self.wrap,
**IOComponent.get_config(self),
}

@staticmethod
def update(
value: Any | Literal[_Keywords.NO_VALUE] | None = _Keywords.NO_VALUE,
Expand Down
14 changes: 0 additions & 14 deletions gradio/components/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,6 @@ def __init__(
self.headers = [c.label or "" for c in self.components]
self.samples_per_page = samples_per_page

def get_config(self):
return {
"components": [component.get_block_name() for component in self.components],
"headers": self.headers,
"samples": self.samples,
"type": self.type,
"label": self.label,
"samples_per_page": self.samples_per_page,
"container": self.container,
"scale": self.scale,
"min_width": self.min_width,
**Component.get_config(self),
}

@staticmethod
def update(
samples: Any | Literal[_Keywords.NO_VALUE] | None = _Keywords.NO_VALUE,
Expand Down
11 changes: 0 additions & 11 deletions gradio/components/dropdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,6 @@ def example_inputs(self) -> dict[str, Any]:
"serialized": self.choices[0] if self.choices else None,
}

def get_config(self):
return {
"choices": self.choices,
"value": self.value,
"multiselect": self.multiselect,
"max_choices": self.max_choices,
"allow_custom_value": self.allow_custom_value,
"container": self.container,
**IOComponent.get_config(self),
}

@staticmethod
def update(
value: Any | Literal[_Keywords.NO_VALUE] | None = _Keywords.NO_VALUE,
Expand Down
Loading
Loading