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

Fix gr.Group, container=False #4916

Merged
merged 16 commits into from Jul 17, 2023
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,7 @@
* The `.change()` event is fixed in `Video` and `Image` so that it only fires once by [@abidlabs](https://github.com/abidlabs) in [PR 4793](https://github.com/gradio-app/gradio/pull/4793)
* The `.change()` event is fixed in `Audio` so that fires when the component value is programmatically updated by [@abidlabs](https://github.com/abidlabs) in [PR 4793](https://github.com/gradio-app/gradio/pull/4793)
- Fixed bug where `gr.Video` could not preprocess urls by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 4904](https://github.com/gradio-app/gradio/pull/4904)
- Fixed `gr.Group` and `container=False`. `container` parameter only available for `Textbox`, `Number`, and `Dropdown`, the only elements where it makes sense. By [@aliabid94](https://github.com/aliabid94) in [PR 4916](https://github.com/gradio-app/gradio/pull/4916)

## Other Changes:

Expand Down
5 changes: 0 additions & 5 deletions gradio/components/annotated_image.py
Expand Up @@ -47,7 +47,6 @@ def __init__(
label: str | None = None,
every: float | None = None,
show_label: bool = True,
container: bool = True,
scale: int | None = None,
min_width: int = 160,
visible: bool = True,
Expand All @@ -65,7 +64,6 @@ def __init__(
label: component name in interface.
every: If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.
show_label: if True, will display label.
container: If True, will place the component in a container - providing some extra padding around the border.
scale: relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer.
min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
visible: If False, component will be hidden.
Expand All @@ -87,7 +85,6 @@ def __init__(
label=label,
every=every,
show_label=show_label,
container=container,
scale=scale,
min_width=min_width,
visible=visible,
Expand Down Expand Up @@ -121,7 +118,6 @@ def update(
color_map: dict[str, str] | None = None,
label: str | None = None,
show_label: bool | None = None,
container: bool | None = None,
scale: int | None = None,
min_width: int | None = None,
visible: bool | None = None,
Expand All @@ -133,7 +129,6 @@ def update(
"color_map": color_map,
"label": label,
"show_label": show_label,
"container": container,
"scale": scale,
"min_width": min_width,
"visible": visible,
Expand Down
5 changes: 0 additions & 5 deletions gradio/components/audio.py
Expand Up @@ -57,7 +57,6 @@ def __init__(
label: str | None = None,
every: float | None = None,
show_label: bool = True,
container: bool = True,
scale: int | None = None,
min_width: int = 160,
interactive: bool | None = None,
Expand All @@ -78,7 +77,6 @@ def __init__(
label: component name in interface.
every: If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.
show_label: if True, will display label.
container: If True, will place the component in a container - providing some extra padding around the border.
scale: relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer.
min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
interactive: if True, will allow users to upload and edit a audio file; if False, can only be used to play audio. If not provided, this is inferred based on whether the component is used as an input or output.
Expand Down Expand Up @@ -119,7 +117,6 @@ def __init__(
label=label,
every=every,
show_label=show_label,
container=container,
scale=scale,
min_width=min_width,
interactive=interactive,
Expand Down Expand Up @@ -153,7 +150,6 @@ def update(
source: Literal["upload", "microphone"] | None = None,
label: str | None = None,
show_label: bool | None = None,
container: bool | None = None,
scale: int | None = None,
min_width: int | None = None,
interactive: bool | None = None,
Expand All @@ -165,7 +161,6 @@ def update(
"source": source,
"label": label,
"show_label": show_label,
"container": container,
"scale": scale,
"min_width": min_width,
"interactive": interactive,
Expand Down
4 changes: 0 additions & 4 deletions gradio/components/bar_plot.py
Expand Up @@ -59,7 +59,6 @@ def __init__(
interactive: bool | None = True,
label: str | None = None,
show_label: bool = True,
container: bool = True,
aliabid94 marked this conversation as resolved.
Show resolved Hide resolved
scale: int | None = None,
min_width: int = 160,
every: float | None = None,
Expand Down Expand Up @@ -116,7 +115,6 @@ def __init__(
value=value,
label=label,
show_label=show_label,
container=container,
scale=scale,
min_width=min_width,
visible=visible,
Expand Down Expand Up @@ -166,7 +164,6 @@ def update(
interactive: bool | None = None,
label: str | None = None,
show_label: bool | None = None,
container: bool | None = None,
scale: int | None = None,
min_width: int | None = None,
visible: bool | None = None,
Expand Down Expand Up @@ -235,7 +232,6 @@ def update(
updated_config = {
"label": label,
"show_label": show_label,
"container": container,
"scale": scale,
"min_width": min_width,
"visible": visible,
Expand Down
3 changes: 0 additions & 3 deletions gradio/components/base.py
Expand Up @@ -134,7 +134,6 @@ def __init__(
label: str | None = None,
info: str | None = None,
show_label: bool = True,
container: bool = True,
scale: int | None = None,
min_width: int | None = None,
interactive: bool | None = None,
Expand All @@ -157,7 +156,6 @@ def __init__(
self.label = label
self.info = info
self.show_label = show_label
self.container = container
if scale is not None and scale != round(scale):
warn_deprecation(
f"'scale' value should be an integer. Using {scale} will cause issues."
Expand Down Expand Up @@ -335,7 +333,6 @@ 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,
Expand Down
5 changes: 0 additions & 5 deletions gradio/components/chatbot.py
Expand Up @@ -43,7 +43,6 @@ def __init__(
label: str | None = None,
every: float | None = None,
show_label: bool = True,
container: bool = True,
scale: int | None = None,
min_width: int = 160,
visible: bool = True,
Expand All @@ -60,7 +59,6 @@ def __init__(
label: component name in interface.
every: If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.
show_label: if True, will display label.
container: If True, will place the component in a container - providing some extra padding around the border.
scale: relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer.
min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
visible: If False, component will be hidden.
Expand Down Expand Up @@ -93,7 +91,6 @@ def __init__(
label=label,
every=every,
show_label=show_label,
container=container,
scale=scale,
min_width=min_width,
visible=visible,
Expand All @@ -120,7 +117,6 @@ def update(
| None = _Keywords.NO_VALUE,
label: str | None = None,
show_label: bool | None = None,
container: bool | None = None,
scale: int | None = None,
min_width: int | None = None,
visible: bool | None = None,
Expand All @@ -130,7 +126,6 @@ def update(
updated_config = {
"label": label,
"show_label": show_label,
"container": container,
"scale": scale,
"min_width": min_width,
"visible": visible,
Expand Down
5 changes: 0 additions & 5 deletions gradio/components/checkbox.py
Expand Up @@ -41,7 +41,6 @@ def __init__(
info: str | None = None,
every: float | None = None,
show_label: bool = True,
container: bool = True,
scale: int | None = None,
min_width: int = 160,
interactive: bool | None = None,
Expand All @@ -57,7 +56,6 @@ def __init__(
info: additional component description.
every: If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.
show_label: if True, will display label.
container: If True, will place the component in a container - providing some extra padding around the border.
scale: relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer.
min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
interactive: if True, this checkbox can be checked; if False, checking will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.
Expand All @@ -77,7 +75,6 @@ def __init__(
info=info,
every=every,
show_label=show_label,
container=container,
scale=scale,
min_width=min_width,
interactive=interactive,
Expand All @@ -101,7 +98,6 @@ def update(
label: str | None = None,
info: str | None = None,
show_label: bool | None = None,
container: bool | None = None,
scale: int | None = None,
min_width: int | None = None,
interactive: bool | None = None,
Expand All @@ -111,7 +107,6 @@ def update(
"label": label,
"info": info,
"show_label": show_label,
"container": container,
"scale": scale,
"min_width": min_width,
"interactive": interactive,
Expand Down
14 changes: 1 addition & 13 deletions gradio/components/checkboxgroup.py
Expand Up @@ -8,7 +8,7 @@
from gradio_client.serializing import ListStringSerializable

from gradio.components.base import FormComponent, IOComponent, _Keywords
from gradio.deprecation import warn_deprecation, warn_style_method_deprecation
from gradio.deprecation import warn_style_method_deprecation
from gradio.events import Changeable, EventListenerMethod, Inputable, Selectable
from gradio.interpretation import NeighborInterpretable

Expand Down Expand Up @@ -43,7 +43,6 @@ def __init__(
info: str | None = None,
every: float | None = None,
show_label: bool = True,
container: bool = True,
scale: int | None = None,
min_width: int = 160,
interactive: bool | None = None,
Expand All @@ -61,7 +60,6 @@ def __init__(
info: additional component description.
every: If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.
show_label: if True, will display label.
container: If True, will place the component in a container - providing some extra padding around the border.
scale: relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer.
min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
interactive: if True, choices in this checkbox group will be checkable; if False, checking will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.
Expand All @@ -88,7 +86,6 @@ def __init__(
info=info,
every=every,
show_label=show_label,
container=container,
scale=scale,
min_width=min_width,
interactive=interactive,
Expand Down Expand Up @@ -123,7 +120,6 @@ def update(
label: str | None = None,
info: str | None = None,
show_label: bool | None = None,
container: bool | None = None,
scale: int | None = None,
min_width: int | None = None,
interactive: bool | None = None,
Expand All @@ -134,7 +130,6 @@ def update(
"label": label,
"info": info,
"show_label": show_label,
"container": container,
"scale": scale,
"min_width": min_width,
"interactive": interactive,
Expand Down Expand Up @@ -197,17 +192,10 @@ def get_interpretation_scores(self, x, neighbors, scores, **kwargs):

def style(
self,
*,
item_container: bool | None = None,
container: bool | None = None,
**kwargs,
):
"""
This method is deprecated. Please set these arguments in the constructor instead.
"""
warn_style_method_deprecation()
if item_container is not None:
warn_deprecation("The `item_container` parameter is deprecated.")
if container is not None:
self.container = container
return self
5 changes: 0 additions & 5 deletions gradio/components/code.py
Expand Up @@ -58,7 +58,6 @@ def __init__(
label: str | None = None,
interactive: bool | None = None,
show_label: bool = True,
container: bool = True,
scale: int | None = None,
min_width: int = 160,
visible: bool = True,
Expand All @@ -73,7 +72,6 @@ def __init__(
label: component name in interface.
interactive: Whether user should be able to enter code or only view it.
show_label: if True, will display label.
container: If True, will place the component in a container - providing some extra padding around the border.
scale: relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer.
min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
visible: If False, component will be hidden.
Expand All @@ -88,7 +86,6 @@ def __init__(
label=label,
interactive=interactive,
show_label=show_label,
container=container,
scale=scale,
min_width=min_width,
visible=visible,
Expand Down Expand Up @@ -123,7 +120,6 @@ def update(
| Literal[_Keywords.NO_VALUE] = _Keywords.NO_VALUE,
label: str | None = None,
show_label: bool | None = None,
container: bool | None = None,
scale: int | None = None,
min_width: int | None = None,
visible: bool | None = None,
Expand All @@ -146,7 +142,6 @@ def update(
return {
"label": label,
"show_label": show_label,
"container": container,
"scale": scale,
"min_width": min_width,
"visible": visible,
Expand Down
5 changes: 0 additions & 5 deletions gradio/components/color_picker.py
Expand Up @@ -38,7 +38,6 @@ def __init__(
info: str | None = None,
every: float | None = None,
show_label: bool = True,
container: bool = True,
scale: int | None = None,
min_width: int = 160,
interactive: bool | None = None,
Expand All @@ -54,7 +53,6 @@ def __init__(
info: additional component description.
every: If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.
show_label: if True, will display label.
container: If True, will place the component in a container - providing some extra padding around the border.
scale: relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer.
min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
interactive: if True, will be rendered as an editable color picker; if False, editing will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.
Expand All @@ -68,7 +66,6 @@ def __init__(
info=info,
every=every,
show_label=show_label,
container=container,
scale=scale,
min_width=min_width,
interactive=interactive,
Expand Down Expand Up @@ -97,7 +94,6 @@ def update(
label: str | None = None,
info: str | None = None,
show_label: bool | None = None,
container: bool | None = None,
scale: int | None = None,
min_width: int | None = None,
visible: bool | None = None,
Expand All @@ -108,7 +104,6 @@ def update(
"label": label,
"info": info,
"show_label": show_label,
"container": container,
"scale": scale,
"min_width": min_width,
"visible": visible,
Expand Down