Event listener cleanup (#3420)

* changes

* changes

* trim out then

* chagnes

* CHANGES

* changes

* changes

* changes

* restore ui

* changes

* changes

* changes

* changes

* changes

* changes

* Update gradio/documentation.py

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* changres

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
This commit is contained in:
aliabid94 2023-03-09 12:58:41 -08:00 committed by GitHub
parent 19f9f06d54
commit c22f84343b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 241 additions and 734 deletions

View File

@ -29,6 +29,7 @@ No changes to highlight.
- Prevent in-place updates of `generic_update` by shallow copying by [@gitgithan](https://github.com/gitgithan) in [PR 3405](https://github.com/gradio-app/gradio/pull/3405) to fix [#3282](https://github.com/gradio-app/gradio/issues/3282)
- Persist file names of files uploaded through any Gradio component by [@abidlabs](https://github.com/abidlabs) in [PR 3412](https://github.com/gradio-app/gradio/pull/3412)
- Fix markdown embedded component in docs by [@aliabd](https://github.com/aliabd) in [PR 3410](https://github.com/gradio-app/gradio/pull/3410)
- Clean up event listeners code by [@aliabid94](https://github.com/aliabid94) in [PR 3420](https://github.com/gradio-app/gradio/pull/3420)
- Fix css issue with spaces logo by [@aliabd](https://github.com/aliabd) in [PR 3422](https://github.com/gradio-app/gradio/pull/3422)
## Contributors Shoutout:

View File

@ -38,6 +38,7 @@ from gradio.events import (
Clearable,
Clickable,
Editable,
EventListener,
Playable,
Releaseable,
Streamable,
@ -77,6 +78,10 @@ class Component(Block):
A base class for defining the methods that all gradio components should have.
"""
def __init__(self, *args, **kwargs):
Block.__init__(self, *args, **kwargs)
EventListener.__init__(self)
def __str__(self):
return self.__repr__()
@ -169,7 +174,7 @@ class IOComponent(Component, Serializable):
every: float | None = None,
**kwargs,
):
super().__init__(elem_id=elem_id, visible=visible, **kwargs)
Component.__init__(self, elem_id=elem_id, visible=visible, **kwargs)
self.label = label
self.info = info
@ -235,7 +240,7 @@ class FormComponent:
return Form
@document("change", "submit", "blur", "style")
@document("style")
class Textbox(
FormComponent,
Changeable,
@ -425,7 +430,7 @@ class Textbox(
return result
@document("change", "submit", "style")
@document("style")
class Number(
FormComponent,
Changeable,
@ -606,7 +611,7 @@ class Number(
return self._round_to_precision(1, self.precision)
@document("change", "style")
@document("style")
class Slider(
FormComponent,
Changeable,
@ -770,7 +775,7 @@ class Slider(
)
@document("change", "style")
@document("style")
class Checkbox(
FormComponent, Changeable, IOComponent, SimpleSerializable, NeighborInterpretable
):
@ -863,7 +868,7 @@ class Checkbox(
return None, scores[0]
@document("change", "style")
@document("style")
class CheckboxGroup(
FormComponent, Changeable, IOComponent, SimpleSerializable, NeighborInterpretable
):
@ -1035,7 +1040,7 @@ class CheckboxGroup(
return Component.style(self, container=container, **kwargs)
@document("change", "style")
@document("style")
class Radio(
FormComponent, Changeable, IOComponent, SimpleSerializable, NeighborInterpretable
):
@ -1184,7 +1189,7 @@ class Radio(
return Component.style(self, container=container, **kwargs)
@document("change", "style")
@document("style")
class Dropdown(Changeable, IOComponent, SimpleSerializable, FormComponent):
"""
Creates a dropdown of choices from which entries can be selected.
@ -1347,7 +1352,7 @@ class Dropdown(Changeable, IOComponent, SimpleSerializable, FormComponent):
return Component.style(self, container=container, **kwargs)
@document("edit", "clear", "change", "stream", "style")
@document("style")
class Image(
Editable,
Clearable,
@ -1702,8 +1707,7 @@ class Image(
# js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
if self.source != "webcam":
raise ValueError("Image streaming only available if source is 'webcam'.")
Streamable.stream(
self,
super().stream(
fn,
inputs,
outputs,
@ -1723,7 +1727,7 @@ class Image(
return str(utils.abspath(input_data))
@document("change", "clear", "play", "pause", "stop", "style")
@document("style")
class Video(
Changeable,
Clearable,
@ -1941,7 +1945,7 @@ class Video(
)
@document("change", "clear", "play", "pause", "stop", "stream", "style")
@document("style")
class Audio(
Changeable,
Clearable,
@ -2225,8 +2229,7 @@ class Audio(
raise ValueError(
"Audio streaming only available if source is 'microphone'."
)
Streamable.stream(
self,
super().stream(
fn,
inputs,
outputs,
@ -2252,7 +2255,7 @@ class Audio(
return Path(input_data).name if input_data else ""
@document("change", "clear", "style")
@document("style")
class File(
Changeable, Clearable, Uploadable, IOComponent, FileSerializable, TempFileManager
):
@ -2476,7 +2479,7 @@ class File(
return Path(input_data).name
@document("change", "style")
@document("style")
class Dataframe(Changeable, IOComponent, JSONSerializable):
"""
Accepts or displays 2D input through a spreadsheet-like component for dataframes.
@ -2746,7 +2749,7 @@ class Dataframe(Changeable, IOComponent, JSONSerializable):
return input_data
@document("change", "style")
@document("style")
class Timeseries(Changeable, IOComponent, JSONSerializable):
"""
Creates a component that can be used to upload/preview timeseries csv files or display a dataframe consisting of a time series graphically.
@ -2929,7 +2932,7 @@ class Variable(State):
return "state"
@document("click", "style")
@document("style")
class Button(Clickable, IOComponent, SimpleSerializable):
"""
Used to create a button, that can be assigned arbitrary click() events. The label (value) of the button can be used as an input or set via the output of a function.
@ -3013,7 +3016,7 @@ class Button(Clickable, IOComponent, SimpleSerializable):
return Component.style(self, **kwargs)
@document("click", "upload", "style")
@document("style")
class UploadButton(
Clickable, Uploadable, IOComponent, FileSerializable, TempFileManager
):
@ -3174,7 +3177,7 @@ class UploadButton(
return Component.style(self, **kwargs)
@document("change", "submit", "style")
@document("style")
class ColorPicker(Changeable, Submittable, IOComponent, SimpleSerializable):
"""
Creates a color picker for user to select a color as string input.
@ -3281,7 +3284,7 @@ class ColorPicker(Changeable, Submittable, IOComponent, SimpleSerializable):
############################
@document("change", "style")
@document("style")
class Label(Changeable, IOComponent, JSONSerializable):
"""
Displays a classification label, along with confidence scores of top categories, if provided.
@ -3416,7 +3419,7 @@ class Label(Changeable, IOComponent, JSONSerializable):
return Component.style(self, container=container)
@document("change", "style")
@document("style")
class HighlightedText(Changeable, IOComponent, JSONSerializable):
"""
Displays text that contains spans that are highlighted by category or numerical value.
@ -3580,7 +3583,7 @@ class HighlightedText(Changeable, IOComponent, JSONSerializable):
return Component.style(self, container=container, **kwargs)
@document("change", "style")
@document("style")
class JSON(Changeable, IOComponent, JSONSerializable):
"""
Used to display arbitrary JSON output prettily.
@ -3667,7 +3670,7 @@ class JSON(Changeable, IOComponent, JSONSerializable):
return Component.style(self, container=container, **kwargs)
@document("change")
@document()
class HTML(Changeable, IOComponent, SimpleSerializable):
"""
Used to display arbitrary HTML output.
@ -3919,7 +3922,7 @@ class Carousel(IOComponent, Changeable, SimpleSerializable):
)
@document("change", "style")
@document("style")
class Chatbot(Changeable, IOComponent, JSONSerializable):
"""
Displays a chatbot output showing both user submitted messages and responses. Supports a subset of Markdown including bold, italics, code, and images.
@ -4026,7 +4029,7 @@ class Chatbot(Changeable, IOComponent, JSONSerializable):
)
@document("change", "edit", "clear", "style")
@document("style")
class Model3D(
Changeable, Editable, Clearable, IOComponent, FileSerializable, TempFileManager
):
@ -4150,7 +4153,7 @@ class Model3D(
return Path(input_data).name if input_data else ""
@document("change", "clear")
@document()
class Plot(Changeable, Clearable, IOComponent, JSONSerializable):
"""
Used to display various kinds of plots (matplotlib, plotly, or bokeh are supported)
@ -4270,7 +4273,7 @@ class AltairPlot:
return alt.Scale(domain=limit) if limit else alt.Undefined
@document("change", "clear")
@document()
class ScatterPlot(Plot):
"""
Create a scatter plot.
@ -4613,7 +4616,7 @@ class ScatterPlot(Plot):
return {"type": "altair", "plot": chart.to_json(), "chart": "scatter"}
@document("change", "clear")
@document()
class LinePlot(Plot):
"""
Create a line plot.
@ -4948,7 +4951,7 @@ class LinePlot(Plot):
return {"type": "altair", "plot": chart.to_json(), "chart": "line"}
@document("change", "clear")
@document()
class BarPlot(Plot):
"""
Create a bar plot.
@ -5262,7 +5265,7 @@ class BarPlot(Plot):
return {"type": "altair", "plot": chart.to_json(), "chart": "bar"}
@document("change")
@document()
class Markdown(IOComponent, Changeable, SimpleSerializable):
"""
Used to render arbitrary Markdown output. Can also render latex enclosed by dollar signs.
@ -5335,7 +5338,7 @@ class Markdown(IOComponent, Changeable, SimpleSerializable):
############################
@document("click", "style")
@document("style")
class Dataset(Clickable, Component):
"""
Used to create an output widget for showing datasets. Used to render the examples

View File

@ -6,6 +6,7 @@ import inspect
from typing import Callable, Dict, List, Tuple
classes_to_document = {}
classes_inherit_documentation = {}
documentation_group = None
@ -16,18 +17,37 @@ def set_documentation_group(m):
classes_to_document[m] = []
def document(*fns):
def extract_instance_attr_doc(cls, attr):
code = inspect.getsource(cls.__init__)
lines = [line.strip() for line in code.split("\n")]
found_attr = False
i = 0
for i, line in enumerate(lines):
if line.startswith("self." + attr):
found_attr = True
break
assert found_attr, f"Could not find {attr} in {cls.__name__}"
start_line = lines.index('"""', i)
end_line = lines.index('"""', start_line + 1)
doc_string = " ".join(lines[start_line + 1 : end_line])
return doc_string
def document(*fns, inherit=False):
"""
Defines the @document decorator which adds classes or functions to the Gradio
documentation at www.gradio.app/docs.
Usage examples:
- Put @document() above a class to document the class and its constructor.
- Put @document(fn1, fn2) above a class to also document the class methods fn1 and fn2.
- Put @document("fn1", "fn2") above a class to also document methods fn1 and fn2.
- Put @document("*fn3") with an asterisk above a class to document the instance attribute methods f3.
"""
def inner_doc(cls):
global documentation_group
if inherit:
classes_inherit_documentation[cls] = None
classes_to_document[documentation_group].append((cls, fns))
return cls
@ -175,13 +195,20 @@ def generate_documentation():
"fns": [],
}
for fn_name in fns:
fn = getattr(cls, fn_name)
instance_attribute_fn = fn_name.startswith("*")
if instance_attribute_fn:
fn_name = fn_name[1:]
fn = getattr(cls(), fn_name)
else:
fn = getattr(cls, fn_name)
(
description_doc,
parameter_docs,
return_docs,
examples_doc,
) = document_fn(fn, cls)
if instance_attribute_fn:
description_doc = extract_instance_attr_doc(cls, fn_name)
cls_documentation["fns"].append(
{
"fn": fn,
@ -194,4 +221,17 @@ def generate_documentation():
}
)
documentation[mode].append(cls_documentation)
if cls in classes_inherit_documentation:
classes_inherit_documentation[cls] = cls_documentation["fns"]
for mode, class_list in classes_to_document.items():
for i, (cls, _) in enumerate(class_list):
for super_class in classes_inherit_documentation:
if (
inspect.isclass(cls)
and issubclass(cls, super_class)
and cls != super_class
):
documentation[mode][i]["fns"] += classes_inherit_documentation[
super_class
]
return documentation

View File

@ -7,11 +7,14 @@ import warnings
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Set
from gradio.blocks import Block
from gradio.documentation import document, set_documentation_group
from gradio.utils import get_cancel_function
if TYPE_CHECKING: # Only import for type checking (is False at runtime).
from gradio.components import Component, StatusTracker
set_documentation_group("events")
def set_cancel_events(
block: Block, event_name: str, cancels: None | Dict[str, Any] | List[Dict[str, Any]]
@ -32,11 +35,30 @@ def set_cancel_events(
class EventListener(Block):
pass
def __init__(self: Any):
for event_listener_class in EventListener.__subclasses__():
if isinstance(self, event_listener_class):
event_listener_class.__init__(self)
class Changeable(EventListener):
def change(
class EventListenerMethod:
"""
Triggered on an event deployment.
"""
def __init__(
self,
trigger: Block,
event_name: str,
show_progress: bool = True,
callback: Callable | None = None,
):
self.trigger = trigger
self.event_name = event_name
self.show_progress = show_progress
self.callback = callback
def __call__(
self,
fn: Callable | None,
inputs: Component | List[Component] | Set[Component] | None = None,
@ -44,7 +66,7 @@ class Changeable(EventListener):
api_name: str | None = None,
status_tracker: StatusTracker | None = None,
scroll_to_output: bool = False,
show_progress: bool = True,
show_progress: bool | None = None,
queue: bool | None = None,
batch: bool = False,
max_batch_size: int = 4,
@ -53,728 +75,162 @@ class Changeable(EventListener):
cancels: Dict[str, Any] | List[Dict[str, Any]] | None = None,
every: float | None = None,
_js: str | None = None,
):
) -> dict:
"""
Parameters:
fn: the function to wrap an interface around. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
api_name: Defining this parameter exposes the endpoint in the api docs
scroll_to_output: If True, will scroll to output component on completion
show_progress: If True, will show progress animation while pending
queue: If True, will place the request on the queue, if the queue exists
batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
cancels: A list of other events to cancel when this event is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method.
every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
"""
# _js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
dep = self.trigger.set_event_trigger(
self.event_name,
fn,
inputs,
outputs,
preprocess=preprocess,
postprocess=postprocess,
scroll_to_output=scroll_to_output,
show_progress=show_progress
if show_progress is not None
else self.show_progress,
api_name=api_name,
js=_js,
queue=queue,
batch=batch,
max_batch_size=max_batch_size,
every=every,
)
set_cancel_events(self.trigger, self.event_name, cancels)
if self.callback:
self.callback()
return dep
@document("*change", inherit=True)
class Changeable(EventListener):
def __init__(self):
self.change = EventListenerMethod(self, "change")
"""
This event is triggered when the component's input value changes (e.g. when the user types in a textbox
or uploads an image). This method can be used when this component is in a Gradio Blocks.
Parameters:
fn: the function to wrap an interface around. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
api_name: Defining this parameter exposes the endpoint in the api docs
scroll_to_output: If True, will scroll to output component on completion
show_progress: If True, will show progress animation while pending
queue: If True, will place the request on the queue, if the queue exists
batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
cancels: A list of other events to cancel when this event is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method.
every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
"""
# _js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
dep = self.set_event_trigger(
"change",
fn,
inputs,
outputs,
preprocess=preprocess,
postprocess=postprocess,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
api_name=api_name,
js=_js,
queue=queue,
batch=batch,
max_batch_size=max_batch_size,
every=every,
)
set_cancel_events(self, "change", cancels)
return dep
@document("*click", inherit=True)
class Clickable(EventListener):
def click(
self,
fn: Callable | None,
inputs: Component | List[Component] | Set[Component] | None = None,
outputs: Component | List[Component] | None = None,
api_name: str | None = None,
status_tracker: StatusTracker | None = None,
scroll_to_output: bool = False,
show_progress: bool = True,
queue=None,
batch: bool = False,
max_batch_size: int = 4,
preprocess: bool = True,
postprocess: bool = True,
cancels: Dict[str, Any] | List[Dict[str, Any]] | None = None,
every: float | None = None,
_js: str | None = None,
):
def __init__(self):
self.click = EventListenerMethod(self, "click")
"""
This event is triggered when the component (e.g. a button) is clicked.
This method can be used when this component is in a Gradio Blocks.
Parameters:
fn: the function to wrap an interface around. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
api_name: Defining this parameter exposes the endpoint in the api docs
scroll_to_output: If True, will scroll to output component on completion
show_progress: If True, will show progress animation while pending
queue: If True, will place the request on the queue, if the queue exists
batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
cancels: A list of other events to cancel when this event is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method.
every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
"""
# _js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
dep = self.set_event_trigger(
"click",
fn,
inputs,
outputs,
preprocess=preprocess,
postprocess=postprocess,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
api_name=api_name,
js=_js,
queue=queue,
batch=batch,
max_batch_size=max_batch_size,
every=every,
)
set_cancel_events(self, "click", cancels)
return dep
@document("*submit", inherit=True)
class Submittable(EventListener):
def submit(
self,
fn: Callable | None,
inputs: Component | List[Component] | Set[Component] | None = None,
outputs: Component | List[Component] | None = None,
api_name: str | None = None,
status_tracker: StatusTracker | None = None,
scroll_to_output: bool = False,
show_progress: bool = True,
queue: bool | None = None,
batch: bool = False,
max_batch_size: int = 4,
preprocess: bool = True,
postprocess: bool = True,
cancels: Dict[str, Any] | List[Dict[str, Any]] | None = None,
every: float | None = None,
_js: str | None = None,
):
def __init__(self):
self.submit = EventListenerMethod(self, "submit")
"""
This event is triggered when the user presses the Enter key while the component (e.g. a textbox) is focused.
This method can be used when this component is in a Gradio Blocks.
Parameters:
fn: the function to wrap an interface around. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
api_name: Defining this parameter exposes the endpoint in the api docs
scroll_to_output: If True, will scroll to output component on completion
show_progress: If True, will show progress animation while pending
queue: If True, will place the request on the queue, if the queue exists
batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
cancels: A list of other events to cancel when this event is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method.
every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
"""
# _js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
dep = self.set_event_trigger(
"submit",
fn,
inputs,
outputs,
preprocess=preprocess,
postprocess=postprocess,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
api_name=api_name,
js=_js,
queue=queue,
batch=batch,
max_batch_size=max_batch_size,
every=every,
)
set_cancel_events(self, "submit", cancels)
return dep
@document("*edit", inherit=True)
class Editable(EventListener):
def edit(
self,
fn: Callable | None,
inputs: Component | List[Component] | Set[Component] | None = None,
outputs: Component | List[Component] | None = None,
api_name: str | None = None,
status_tracker: StatusTracker | None = None,
scroll_to_output: bool = False,
show_progress: bool = True,
queue: bool | None = None,
batch: bool = False,
max_batch_size: int = 4,
preprocess: bool = True,
postprocess: bool = True,
cancels: Dict[str, Any] | List[Dict[str, Any]] | None = None,
every: float | None = None,
_js: str | None = None,
):
def __init__(self):
self.edit = EventListenerMethod(self, "edit")
"""
This event is triggered when the user edits the component (e.g. image) using the
built-in editor. This method can be used when this component is in a Gradio Blocks.
Parameters:
fn: the function to wrap an interface around. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
api_name: Defining this parameter exposes the endpoint in the api docs
scroll_to_output: If True, will scroll to output component on completion
show_progress: If True, will show progress animation while pending
queue: If True, will place the request on the queue, if the queue exists
batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
cancels: A list of other events to cancel when this event is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method.
every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
"""
# _js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
dep = self.set_event_trigger(
"edit",
fn,
inputs,
outputs,
preprocess=preprocess,
postprocess=postprocess,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
api_name=api_name,
js=_js,
queue=queue,
batch=batch,
max_batch_size=max_batch_size,
every=every,
)
set_cancel_events(self, "edit", cancels)
return dep
@document("*clear", inherit=True)
class Clearable(EventListener):
def clear(
self,
fn: Callable | None,
inputs: Component | List[Component] | Set[Component] | None = None,
outputs: Component | List[Component] | None = None,
api_name: str | None = None,
status_tracker: StatusTracker | None = None,
scroll_to_output: bool = False,
show_progress: bool = True,
queue: bool | None = None,
batch: bool = False,
max_batch_size: int = 4,
preprocess: bool = True,
postprocess: bool = True,
cancels: Dict[str, Any] | List[Dict[str, Any]] | None = None,
every: float | None = None,
_js: str | None = None,
):
def __init__(self):
self.clear = EventListenerMethod(self, "clear")
"""
This event is triggered when the user clears the component (e.g. image or audio)
using the X button for the component. This method can be used when this component is in a Gradio Blocks.
Parameters:
fn: the function to wrap an interface around. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
api_name: Defining this parameter exposes the endpoint in the api docs
scroll_to_output: If True, will scroll to output component on completion
show_progress: If True, will show progress animation while pending
queue: If True, will place the request on the queue, if the queue exists
batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
cancels: A list of other events to cancel when this event is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method.
every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
"""
# _js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
dep = self.set_event_trigger(
"clear",
fn,
inputs,
outputs,
preprocess=preprocess,
postprocess=postprocess,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
api_name=api_name,
js=_js,
queue=queue,
batch=batch,
max_batch_size=max_batch_size,
every=every,
)
set_cancel_events(self, "clear", cancels)
return dep
@document("*play", "*pause", "*stop", inherit=True)
class Playable(EventListener):
def play(
self,
fn: Callable | None,
inputs: Component | List[Component] | Set[Component] | None = None,
outputs: Component | List[Component] | None = None,
api_name: str | None = None,
status_tracker: StatusTracker | None = None,
scroll_to_output: bool = False,
show_progress: bool = True,
queue: bool | None = None,
batch: bool = False,
max_batch_size: int = 4,
preprocess: bool = True,
postprocess: bool = True,
cancels: Dict[str, Any] | List[Dict[str, Any]] | None = None,
every: float | None = None,
_js: str | None = None,
):
def __init__(self):
self.play = EventListenerMethod(self, "play")
"""
This event is triggered when the user plays the component (e.g. audio or video).
This method can be used when this component is in a Gradio Blocks.
Parameters:
fn: the function to wrap an interface around. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
api_name: Defining this parameter exposes the endpoint in the api docs
scroll_to_output: If True, will scroll to output component on completion
show_progress: If True, will show progress animation while pending
queue: If True, will place the request on the queue, if the queue exists
batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
cancels: A list of other events to cancel when this event is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method.
every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
"""
# _js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
dep = self.set_event_trigger(
"play",
fn,
inputs,
outputs,
preprocess=preprocess,
postprocess=postprocess,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
api_name=api_name,
js=_js,
queue=queue,
batch=batch,
max_batch_size=max_batch_size,
every=every,
)
set_cancel_events(self, "play", cancels)
return dep
def pause(
self,
fn: Callable | None,
inputs: Component | List[Component] | Set[Component] | None = None,
outputs: Component | List[Component] | None = None,
api_name: str | None = None,
status_tracker: StatusTracker | None = None,
scroll_to_output: bool = False,
show_progress: bool = True,
queue: bool | None = None,
batch: bool = False,
max_batch_size: int = 4,
preprocess: bool = True,
postprocess: bool = True,
cancels: Dict[str, Any] | List[Dict[str, Any]] | None = None,
every: float | None = None,
_js: str | None = None,
):
self.pause = EventListenerMethod(self, "pause")
"""
This event is triggered when the user pauses the component (e.g. audio or video).
This method can be used when this component is in a Gradio Blocks.
Parameters:
fn: the function to wrap an interface around. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
api_name: Defining this parameter exposes the endpoint in the api docs
scroll_to_output: If True, will scroll to output component on completion
show_progress: If True, will show progress animation while pending
queue: If True, will place the request on the queue, if the queue exists
batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
cancels: A list of other events to cancel when this event is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method.
every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
"""
# _js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
dep = self.set_event_trigger(
"pause",
fn,
inputs,
outputs,
preprocess=preprocess,
postprocess=postprocess,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
api_name=api_name,
js=_js,
queue=queue,
batch=batch,
max_batch_size=max_batch_size,
every=every,
)
set_cancel_events(self, "pause", cancels)
return dep
def stop(
self,
fn: Callable | None,
inputs: Component | List[Component] | Set[Component] | None = None,
outputs: Component | List[Component] | None = None,
api_name: str | None = None,
status_tracker: StatusTracker | None = None,
scroll_to_output: bool = False,
show_progress: bool = True,
queue: bool | None = None,
batch: bool = False,
max_batch_size: int = 4,
preprocess: bool = True,
postprocess: bool = True,
cancels: Dict[str, Any] | List[Dict[str, Any]] | None = None,
every: float | None = None,
_js: str | None = None,
):
self.stop = EventListenerMethod(self, "stop")
"""
This event is triggered when the user stops the component (e.g. audio or video).
This method can be used when this component is in a Gradio Blocks.
Parameters:
fn: the function to wrap an interface around. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
api_name: Defining this parameter exposes the endpoint in the api docs
scroll_to_output: If True, will scroll to output component on completion
show_progress: If True, will show progress animation while pending
queue: If True, will place the request on the queue, if the queue exists
batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
cancels: A list of other events to cancel when this event is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method.
every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
"""
# _js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
dep = self.set_event_trigger(
"stop",
fn,
inputs,
outputs,
preprocess=preprocess,
postprocess=postprocess,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
api_name=api_name,
js=_js,
queue=queue,
batch=batch,
max_batch_size=max_batch_size,
every=every,
)
set_cancel_events(self, "stop", cancels)
return dep
@document("*stream", inherit=True)
class Streamable(EventListener):
def stream(
self,
fn: Callable | None,
inputs: Component | List[Component] | Set[Component] | None = None,
outputs: Component | List[Component] | None = None,
api_name: str | None = None,
status_tracker: StatusTracker | None = None,
scroll_to_output: bool = False,
show_progress: bool = False,
queue: bool | None = None,
batch: bool = False,
max_batch_size: int = 4,
preprocess: bool = True,
postprocess: bool = True,
cancels: Dict[str, Any] | List[Dict[str, Any]] | None = None,
every: float | None = None,
_js: str | None = None,
):
def __init__(self):
self.streaming: bool
self.stream = EventListenerMethod(
self,
"stream",
show_progress=False,
callback=lambda: setattr(self, "streaming", True),
)
"""
This event is triggered when the user streams the component (e.g. a live webcam
component). This method can be used when this component is in a Gradio Blocks.
Parameters:
fn: the function to wrap an interface around. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
api_name: Defining this parameter exposes the endpoint in the api docs
scroll_to_output: If True, will scroll to output component on completion
show_progress: If True, will show progress animation while pending
queue: If True, will place the request on the queue, if the queue exists
batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
cancels: A list of other events to cancel when this event is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method.
every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
"""
# _js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
self.streaming = True
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
dep = self.set_event_trigger(
"stream",
fn,
inputs,
outputs,
preprocess=preprocess,
postprocess=postprocess,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
api_name=api_name,
js=_js,
queue=queue,
batch=batch,
max_batch_size=max_batch_size,
every=every,
)
set_cancel_events(self, "stream", cancels)
return dep
@document("*blur", inherit=True)
class Blurrable(EventListener):
def blur(
self,
fn: Callable | None,
inputs: Component | List[Component] | Set[Component] | None = None,
outputs: Component | List[Component] | None = None,
api_name: str | None = None,
scroll_to_output: bool = False,
show_progress: bool = True,
queue: bool | None = None,
batch: bool = False,
max_batch_size: int = 4,
preprocess: bool = True,
postprocess: bool = True,
cancels: Dict[str, Any] | List[Dict[str, Any]] | None = None,
every: float | None = None,
_js: str | None = None,
):
def __init__(self):
self.blur = EventListenerMethod(self, "blur")
"""
This event is triggered when the component's is unfocused/blurred (e.g. when the user clicks outside of a textbox). This method can be used when this component is in a Gradio Blocks.
Parameters:
fn: Callable function
inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
api_name: Defining this parameter exposes the endpoint in the api docs
scroll_to_output: If True, will scroll to output component on completion
show_progress: If True, will show progress animation while pending
queue: If True, will place the request on the queue, if the queue exists
batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
cancels: A list of other events to cancel when this event is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method.
every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
"""
# _js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
self.set_event_trigger(
"blur",
fn,
inputs,
outputs,
preprocess=preprocess,
postprocess=postprocess,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
api_name=api_name,
js=_js,
queue=queue,
batch=batch,
max_batch_size=max_batch_size,
every=every,
)
set_cancel_events(self, "blur", cancels)
@document("*upload", inherit=True)
class Uploadable(EventListener):
def upload(
self,
fn: Callable | None,
inputs: List[Component],
outputs: Component | List[Component] | None = None,
api_name: str | None = None,
scroll_to_output: bool = False,
show_progress: bool = True,
queue: bool | None = None,
batch: bool = False,
max_batch_size: int = 4,
preprocess: bool = True,
postprocess: bool = True,
cancels: List[Dict[str, Any]] | None = None,
every: float | None = None,
_js: str | None = None,
):
def __init__(self):
self.upload = EventListenerMethod(self, "upload")
"""
This event is triggered when the user uploads a file into the component (e.g. when the user uploads a video into a video component). This method can be used when this component is in a Gradio Blocks.
Parameters:
fn: Callable function
inputs: List of inputs
outputs: List of outputs
api_name: Defining this parameter exposes the endpoint in the api docs
scroll_to_output: If True, will scroll to output component on completion
show_progress: If True, will show progress animation while pending
queue: If True, will place the request on the queue, if the queue exists
batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
cancels: A list of other events to cancel when this event is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method.
every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
"""
# _js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
self.set_event_trigger(
"upload",
fn,
inputs,
outputs,
preprocess=preprocess,
postprocess=postprocess,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
api_name=api_name,
js=_js,
queue=queue,
batch=batch,
max_batch_size=max_batch_size,
every=every,
)
set_cancel_events(self, "upload", cancels)
@document("*release", inherit=True)
class Releaseable(EventListener):
def release(
self,
fn: Callable | None,
inputs: Component | List[Component] | Set[Component] | None = None,
outputs: Component | List[Component] | None = None,
api_name: str | None = None,
scroll_to_output: bool = False,
show_progress: bool = True,
queue: bool | None = None,
batch: bool = False,
max_batch_size: int = 4,
preprocess: bool = True,
postprocess: bool = True,
cancels: Dict[str, Any] | List[Dict[str, Any]] | None = None,
every: float | None = None,
_js: str | None = None,
):
def __init__(self):
self.release = EventListenerMethod(self, "release")
"""
This event is triggered when the user releases the mouse on this component (e.g. when the user releases the slider). This method can be used when this component is in a Gradio Blocks.
Parameters:
fn: Callable function
inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
api_name: Defining this parameter exposes the endpoint in the api docs
scroll_to_output: If True, will scroll to output component on completion
show_progress: If True, will show progress animation while pending
queue: If True, will place the request on the queue, if the queue exists
batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
cancels: A list of other events to cancel when this event is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method.
every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
"""
# _js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
self.set_event_trigger(
"release",
fn,
inputs,
outputs,
preprocess=preprocess,
postprocess=postprocess,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
api_name=api_name,
js=_js,
queue=queue,
batch=batch,
max_batch_size=max_batch_size,
every=every,
)
set_cancel_events(self, "release", cancels)

93
ui/pnpm-lock.yaml generated
View File

@ -1,4 +1,4 @@
lockfileVersion: 5.4
lockfileVersion: 5.3
importers:
@ -48,7 +48,7 @@ importers:
'@tailwindcss/forms': 0.5.0_tailwindcss@3.1.6
'@testing-library/dom': 8.11.3
'@testing-library/svelte': 3.1.0_svelte@3.49.0
'@testing-library/user-event': 13.5.0_gzufz4q333be4gqfrvipwvqt6a
'@testing-library/user-event': 13.5.0_@testing-library+dom@8.11.3
autoprefixer: 10.4.4_postcss@8.4.6
babylonjs: 5.18.0
babylonjs-loaders: 5.18.0
@ -65,15 +65,15 @@ importers:
postcss-nested: 5.0.6_postcss@8.4.6
postcss-prefix-selector: 1.16.0_postcss@8.4.6
prettier: 2.6.2
prettier-plugin-css-order: 1.3.0_ob5okuz2s5mlecytbeo2erc43a
prettier-plugin-svelte: 2.7.0_3cyj5wbackxvw67rnaarcmbw7y
prettier-plugin-css-order: 1.3.0_postcss@8.4.6+prettier@2.6.2
prettier-plugin-svelte: 2.7.0_prettier@2.6.2+svelte@3.49.0
sirv: 2.0.2
sirv-cli: 2.0.2
svelte: 3.49.0
svelte-check: 2.8.0_mgmdnb6x5rpawk37gozc2sbtta
svelte-check: 2.8.0_postcss@8.4.6+svelte@3.49.0
svelte-i18n: 3.3.13_svelte@3.49.0
svelte-preprocess: 4.10.6_mlkquajfpxs65rn6bdfntu7nmy
tailwindcss: 3.1.6_postcss@8.4.6
svelte-preprocess: 4.10.6_62d50a01257de5eec5be08cad9d3ed66
tailwindcss: 3.1.6
tinyspy: 0.3.0
typescript: 4.7.4
vite: 2.9.9
@ -339,7 +339,7 @@ importers:
'@gradio/utils': link:../utils
'@rollup/plugin-json': 5.0.2
plotly.js-dist-min: 2.11.1
svelte-vega: 1.2.0_36sthfwhgi34qytpvkzggbhnle
svelte-vega: 1.2.0_vega-lite@5.6.0+vega@5.22.1
vega: 5.22.1
vega-lite: 5.6.0_vega@5.22.1
@ -471,14 +471,14 @@ importers:
'@gradio/video': link:../video
svelte: 3.49.0
devDependencies:
'@sveltejs/adapter-auto': 1.0.0-next.91_b2bjiolq6much32vueqoio7eoy
'@sveltejs/adapter-auto': 1.0.0-next.91_@sveltejs+kit@1.0.0-next.318
'@sveltejs/kit': 1.0.0-next.318_svelte@3.49.0
autoprefixer: 10.4.2_postcss@8.4.6
postcss: 8.4.6
postcss-load-config: 3.1.1
svelte-check: 2.4.1_onvlxjpnd23pr3hxbmout2wrjm
svelte-preprocess: 4.10.2_2udzbozq3wemyrf2xz7puuv2zy
tailwindcss: 3.1.6_postcss@8.4.6
svelte-check: 2.4.1_736abba5ed1eb6f8ecf70b1d49ead14b
svelte-preprocess: 4.10.2_d50790bb30dd88cc44babe7efa52bace
tailwindcss: 3.1.6
tslib: 2.3.1
typescript: 4.5.5
@ -680,7 +680,7 @@ packages:
picomatch: 2.3.1
dev: false
/@sveltejs/adapter-auto/1.0.0-next.91_b2bjiolq6much32vueqoio7eoy:
/@sveltejs/adapter-auto/1.0.0-next.91_@sveltejs+kit@1.0.0-next.318:
resolution: {integrity: sha512-U57tQdzTfFINim8tzZSARC9ztWPzwOoHwNOpGdb2o6XrD0mEQwU9DsII7dBblvzg+xCnmd0pw7PDtXz5c5t96w==}
peerDependencies:
'@sveltejs/kit': ^1.0.0-next.587
@ -736,7 +736,7 @@ packages:
tailwindcss: '>=3.0.0 || >= 3.0.0-alpha.1'
dependencies:
mini-svg-data-uri: 1.4.4
tailwindcss: 3.1.6_postcss@8.4.6
tailwindcss: 3.1.6
dev: false
/@testing-library/dom/7.31.2:
@ -777,7 +777,7 @@ packages:
svelte: 3.49.0
dev: false
/@testing-library/user-event/13.5.0_gzufz4q333be4gqfrvipwvqt6a:
/@testing-library/user-event/13.5.0_@testing-library+dom@8.11.3:
resolution: {integrity: sha512-5Kwtbo3Y/NowpkbRuSepbyMFkZmHgD+vPzYB/RJ4oxt5Gj/avFFBYjhw27cqSVPVw/3a67NK1PbiIr9k4Gwmdg==}
engines: {node: '>=10', npm: '>=6'}
peerDependencies:
@ -2982,25 +2982,25 @@ packages:
postcss-value-parser: 4.2.0
dev: false
/postcss-import/14.1.0_postcss@8.4.6:
/postcss-import/14.1.0_postcss@8.4.21:
resolution: {integrity: sha512-flwI+Vgm4SElObFVPpTIT7SU7R3qk2L7PyduMcokiaVKuWv9d/U+Gm/QAd8NDLuykTWTkcrjOeD2Pp1rMeBTGw==}
engines: {node: '>=10.0.0'}
peerDependencies:
postcss: ^8.0.0
dependencies:
postcss: 8.4.6
postcss: 8.4.21
postcss-value-parser: 4.2.0
read-cache: 1.0.0
resolve: 1.22.1
/postcss-js/4.0.0_postcss@8.4.6:
/postcss-js/4.0.0_postcss@8.4.21:
resolution: {integrity: sha512-77QESFBwgX4irogGVPgQ5s07vLvFqWr228qZY+w6lW599cRlK/HmnlivnnVUxkjHnCu4J16PDMHcH+e+2HbvTQ==}
engines: {node: ^12 || ^14 || >= 16}
peerDependencies:
postcss: ^8.3.3
dependencies:
camelcase-css: 2.0.1
postcss: 8.4.6
postcss: 8.4.21
/postcss-less/6.0.0_postcss@8.4.6:
resolution: {integrity: sha512-FPX16mQLyEjLzEuuJtxA8X3ejDLNGGEG503d2YGZR5Ask1SpDN8KmZUMpzCvyalWRywAn1n1VOA5dcqfCLo5rg==}
@ -3024,7 +3024,7 @@ packages:
yaml: 1.10.2
dev: true
/postcss-load-config/3.1.4_postcss@8.4.6:
/postcss-load-config/3.1.4_postcss@8.4.21:
resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==}
engines: {node: '>= 10'}
peerDependencies:
@ -3037,9 +3037,18 @@ packages:
optional: true
dependencies:
lilconfig: 2.0.6
postcss: 8.4.6
postcss: 8.4.21
yaml: 1.10.2
/postcss-nested/5.0.6_postcss@8.4.21:
resolution: {integrity: sha512-rKqm2Fk0KbA8Vt3AdGN0FB9OBOMDVajMG6ZCf/GoHgdxUJ4sBFp0A/uMIRm+MJUdo33YXEtjqIz8u7DAp8B7DA==}
engines: {node: '>=12.0'}
peerDependencies:
postcss: ^8.2.14
dependencies:
postcss: 8.4.21
postcss-selector-parser: 6.0.9
/postcss-nested/5.0.6_postcss@8.4.6:
resolution: {integrity: sha512-rKqm2Fk0KbA8Vt3AdGN0FB9OBOMDVajMG6ZCf/GoHgdxUJ4sBFp0A/uMIRm+MJUdo33YXEtjqIz8u7DAp8B7DA==}
engines: {node: '>=12.0'}
@ -3048,6 +3057,7 @@ packages:
dependencies:
postcss: 8.4.6
postcss-selector-parser: 6.0.9
dev: false
/postcss-prefix-selector/1.16.0_postcss@8.4.21:
resolution: {integrity: sha512-rdVMIi7Q4B0XbXqNUEI+Z4E+pueiu/CS5E6vRCQommzdQ/sgsS4dK42U7GX8oJR+TJOtT+Qv3GkNo6iijUMp3Q==}
@ -3106,7 +3116,6 @@ packages:
nanoid: 3.3.4
picocolors: 1.0.0
source-map-js: 1.0.2
dev: false
/postcss/8.4.6:
resolution: {integrity: sha512-OovjwIzs9Te46vlEx7+uXB0PLijpwjXGKXjVGGPIGubGpq7uh5Xgf6D6FiJ/SzJMBosHDp6a2hiXOS97iBXcaA==}
@ -3116,7 +3125,7 @@ packages:
picocolors: 1.0.0
source-map-js: 1.0.2
/prettier-plugin-css-order/1.3.0_ob5okuz2s5mlecytbeo2erc43a:
/prettier-plugin-css-order/1.3.0_postcss@8.4.6+prettier@2.6.2:
resolution: {integrity: sha512-wOS4qlbUARCoiiuOG0TiB/j751soC3+gUnMMva5HVWKvHJdLNYqh+jXK3MvvixR6xkJVPxHSF7rIIhkHIuHTFg==}
engines: {node: '>=14'}
peerDependencies:
@ -3131,7 +3140,7 @@ packages:
- postcss
dev: false
/prettier-plugin-svelte/2.7.0_3cyj5wbackxvw67rnaarcmbw7y:
/prettier-plugin-svelte/2.7.0_prettier@2.6.2+svelte@3.49.0:
resolution: {integrity: sha512-fQhhZICprZot2IqEyoiUYLTRdumULGRvw0o4dzl5jt0jfzVWdGqeYW27QTWAeXhoupEZJULmNoH3ueJwUWFLIA==}
peerDependencies:
prettier: ^1.16.4 || ^2.0.0
@ -3589,7 +3598,7 @@ packages:
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
engines: {node: '>= 0.4'}
/svelte-check/2.4.1_onvlxjpnd23pr3hxbmout2wrjm:
/svelte-check/2.4.1_736abba5ed1eb6f8ecf70b1d49ead14b:
resolution: {integrity: sha512-xhf3ShP5rnRwBokrgTBJ/0cO9QIc1DAVu1NWNRTfCDsDBNjGmkS3HgitgUadRuoMKj1+irZR/yHJ+Uqobnkbrw==}
hasBin: true
peerDependencies:
@ -3603,7 +3612,7 @@ packages:
sade: 1.8.1
source-map: 0.7.3
svelte: 3.49.0
svelte-preprocess: 4.10.2_2udzbozq3wemyrf2xz7puuv2zy
svelte-preprocess: 4.10.2_d50790bb30dd88cc44babe7efa52bace
typescript: 4.5.5
transitivePeerDependencies:
- '@babel/core'
@ -3618,7 +3627,7 @@ packages:
- sugarss
dev: true
/svelte-check/2.8.0_mgmdnb6x5rpawk37gozc2sbtta:
/svelte-check/2.8.0_postcss@8.4.6+svelte@3.49.0:
resolution: {integrity: sha512-HRL66BxffMAZusqe5I5k26mRWQ+BobGd9Rxm3onh7ZVu0nTk8YTKJ9vu3LVPjUGLU9IX7zS+jmwPVhJYdXJ8vg==}
hasBin: true
peerDependencies:
@ -3631,7 +3640,7 @@ packages:
picocolors: 1.0.0
sade: 1.8.1
svelte: 3.49.0
svelte-preprocess: 4.10.6_mlkquajfpxs65rn6bdfntu7nmy
svelte-preprocess: 4.10.6_62d50a01257de5eec5be08cad9d3ed66
typescript: 4.7.4
transitivePeerDependencies:
- '@babel/core'
@ -3669,7 +3678,7 @@ packages:
tiny-glob: 0.2.9
dev: false
/svelte-preprocess/4.10.2_2udzbozq3wemyrf2xz7puuv2zy:
/svelte-preprocess/4.10.2_d50790bb30dd88cc44babe7efa52bace:
resolution: {integrity: sha512-aPpkCreSo8EL/y8kJSa1trhiX0oyAtTjlNNM7BNjRAsMJ8Yy2LtqHt0zyd4pQPXt+D4PzbO3qTjjio3kwOxDlA==}
engines: {node: '>= 9.11.2'}
requiresBuild: true
@ -3722,7 +3731,7 @@ packages:
typescript: 4.5.5
dev: true
/svelte-preprocess/4.10.6_mlkquajfpxs65rn6bdfntu7nmy:
/svelte-preprocess/4.10.6_62d50a01257de5eec5be08cad9d3ed66:
resolution: {integrity: sha512-I2SV1w/AveMvgIQlUF/ZOO3PYVnhxfcpNyGt8pxpUVhPfyfL/CZBkkw/KPfuFix5FJ9TnnNYMhACK3DtSaYVVQ==}
engines: {node: '>= 9.11.2'}
requiresBuild: true
@ -3778,7 +3787,7 @@ packages:
resolution: {integrity: sha512-VTWHOdwDyWbndGZnI0PQJY9DO7hgQlNubtCcCL6Wlypv5dU4vEsc4A1sX9TWMuvebEe4332SgsQQHzOdZ+guhQ==}
dev: false
/svelte-vega/1.2.0_36sthfwhgi34qytpvkzggbhnle:
/svelte-vega/1.2.0_vega-lite@5.6.0+vega@5.22.1:
resolution: {integrity: sha512-MsDdO+l7o/d9d4mVkh8MBDhqZvJ45lpuprBaTj0V/ZilIG902QERHFQlam3ZFcR9C9OIKSpmPqINssWNPkDdcA==}
peerDependencies:
vega: '*'
@ -3786,7 +3795,7 @@ packages:
dependencies:
fast-deep-equal: 3.1.3
vega: 5.22.1
vega-embed: 6.21.0_36sthfwhgi34qytpvkzggbhnle
vega-embed: 6.21.0_vega-lite@5.6.0+vega@5.22.1
vega-lite: 5.6.0_vega@5.22.1
dev: false
@ -3813,12 +3822,10 @@ packages:
resolution: {integrity: sha512-hIdwt/c/e1ONnr2RJmfBxEAj/J6KQQWKdToF3Qw8ZNRsTNNteGkOe63rQy9I7J5UNlr8Yl0wkzIr9wgLY94x0Q==}
dev: false
/tailwindcss/3.1.6_postcss@8.4.6:
/tailwindcss/3.1.6:
resolution: {integrity: sha512-7skAOY56erZAFQssT1xkpk+kWt2NrO45kORlxFPXUt3CiGsVPhH1smuH5XoDH6sGPXLyBv+zgCKA2HWBsgCytg==}
engines: {node: '>=12.13.0'}
hasBin: true
peerDependencies:
postcss: ^8.0.9
dependencies:
arg: 5.0.2
chokidar: 3.5.3
@ -3833,11 +3840,11 @@ packages:
normalize-path: 3.0.0
object-hash: 3.0.0
picocolors: 1.0.0
postcss: 8.4.6
postcss-import: 14.1.0_postcss@8.4.6
postcss-js: 4.0.0_postcss@8.4.6
postcss-load-config: 3.1.4_postcss@8.4.6
postcss-nested: 5.0.6_postcss@8.4.6
postcss: 8.4.21
postcss-import: 14.1.0_postcss@8.4.21
postcss-js: 4.0.0_postcss@8.4.21
postcss-load-config: 3.1.4_postcss@8.4.21
postcss-nested: 5.0.6_postcss@8.4.21
postcss-selector-parser: 6.0.10
postcss-value-parser: 4.2.0
quick-lru: 5.1.1
@ -4020,7 +4027,7 @@ packages:
- encoding
dev: false
/vega-embed/6.21.0_36sthfwhgi34qytpvkzggbhnle:
/vega-embed/6.21.0_vega-lite@5.6.0+vega@5.22.1:
resolution: {integrity: sha512-Tzo9VAfgNRb6XpxSFd7uphSeK2w5OxDY2wDtmpsQ+rQlPSEEI9TE6Jsb2nHRLD5J4FrmXKLrTcORqidsNQSXEg==}
peerDependencies:
vega: ^5.21.0
@ -4034,7 +4041,7 @@ packages:
vega-interpreter: 1.0.4
vega-lite: 5.6.0_vega@5.22.1
vega-schema-url-parser: 2.2.0
vega-themes: 2.12.0_36sthfwhgi34qytpvkzggbhnle
vega-themes: 2.12.0_vega-lite@5.6.0+vega@5.22.1
vega-tooltip: 0.28.0
dev: false
bundledDependencies:
@ -4253,7 +4260,7 @@ packages:
d3-array: 3.1.1
dev: false
/vega-themes/2.12.0_36sthfwhgi34qytpvkzggbhnle:
/vega-themes/2.12.0_vega-lite@5.6.0+vega@5.22.1:
resolution: {integrity: sha512-gHNYCzDgexSQDmGzQsxH57OYgFVbAOmvhIYN3MPOvVucyI+zhbUawBVIVNzG9ftucRp0MaaMVXi6ctC5HLnBsg==}
peerDependencies:
vega: '*'