Promotes postprocess and preprocess to documented parameters (#2293)

* changes

* Delete media_data.py.isorted

* fixes in other files

* fixes in other files

* added for grid

* removed status tracker

* removed status tracker

* added deprecation warning

* formatting
This commit is contained in:
Abubakar Abid 2022-09-19 19:38:17 -05:00 committed by GitHub
parent bbd1c7237e
commit 6c33eed976
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 170 additions and 136 deletions

View File

@ -27,7 +27,7 @@ with gr.Blocks() as demo:
strength.change(sepia, [img_input, strength], img_output)
# We can choose which components to flag -- in this case, we'll flag all of them
btn.click(lambda *args: callback.flag(args), [img_input, strength, img_output], None, _preprocess=False)
btn.click(lambda *args: callback.flag(args), [img_input, strength, img_output], None, preprocess=False)
if __name__ == "__main__":
demo.launch()

View File

@ -236,7 +236,6 @@
],
"backend_fn": true,
"js": null,
"status_tracker": null,
"queue": null,
"api_name": null,
"scroll_to_output": false,
@ -255,7 +254,6 @@
],
"backend_fn": true,
"js": null,
"status_tracker": null,
"queue": null,
"api_name": null,
"scroll_to_output": false,
@ -276,7 +274,6 @@
],
"backend_fn": true,
"js": null,
"status_tracker": null,
"queue": false,
"api_name": null,
"scroll_to_output": false,
@ -296,7 +293,6 @@
],
"backend_fn": true,
"js": null,
"status_tracker": null,
"queue": false,
"api_name": null,
"scroll_to_output": false,

View File

@ -118,7 +118,7 @@
],
"backend_fn": true,
"js": null,
"status_tracker": null,
"": null,
"queue": null,
"api_name": null,
"scroll_to_output": false,

View File

@ -59,7 +59,6 @@
],
"backend_fn": true,
"js": false,
"status_tracker": null,
"queue": null,
"api_name": null,
"scroll_to_output": false,

View File

@ -108,7 +108,6 @@
],
"backend_fn": true,
"js": null,
"status_tracker": null,
"queue": null
}
]

View File

@ -273,7 +273,6 @@
],
"backend_fn": true,
"js": null,
"status_tracker": 9,
"queue": null,
"api_name": "xray_model",
"scroll_to_output": false,
@ -311,7 +310,6 @@
],
"backend_fn": true,
"js": null,
"status_tracker": 15,
"queue": null,
"api_name": "ct_model",
"scroll_to_output": false,
@ -347,7 +345,6 @@
"outputs": [],
"backend_fn": true,
"js": null,
"status_tracker": 17,
"queue": null,
"api_name": null,
"scroll_to_output": false,

View File

@ -30,12 +30,10 @@ With this model you can lorem ipsum
xray_scan = gr.Image()
xray_results = gr.JSON()
xray_run = gr.Button("Run")
xray_progress = gr.StatusTracker(cover_container=True)
xray_run.click(
xray_model,
inputs=[disease, xray_scan],
outputs=xray_results,
status_tracker=xray_progress,
api_name="xray_model"
)
@ -44,12 +42,10 @@ With this model you can lorem ipsum
ct_scan = gr.Image()
ct_results = gr.JSON()
ct_run = gr.Button("Run")
ct_progress = gr.StatusTracker(cover_container=True)
ct_run.click(
ct_model,
inputs=[disease, ct_scan],
outputs=ct_results,
status_tracker=ct_progress,
api_name="ct_model"
)
@ -58,7 +54,6 @@ With this model you can lorem ipsum
lambda ct, xr: time.sleep(5),
inputs=[ct_results, xray_results],
outputs=[],
status_tracker=gr.StatusTracker(),
)
if __name__ == "__main__":

View File

@ -1071,7 +1071,7 @@
],
"backend_fn": true,
"js": null,
"status_tracker": 42,
"status_tracker": null,
"queue": null,
"api_name": "predict",
"scroll_to_output": true,

View File

@ -351,7 +351,6 @@
],
"backend_fn": true,
"js": null,
"status_tracker": 14,
"queue": null,
"api_name": "predict",
"scroll_to_output": true,
@ -404,7 +403,6 @@
],
"backend_fn": false,
"js": "() => [null, 3.2, null, [], null, null, {\"variant\": null, \"visible\": true, \"__type__\": \"update\"}]\n ",
"status_tracker": null,
"queue": null,
"api_name": null,
"scroll_to_output": false,
@ -426,7 +424,6 @@
"outputs": [],
"backend_fn": true,
"js": null,
"status_tracker": null,
"queue": false,
"api_name": null,
"scroll_to_output": false,

View File

@ -114,7 +114,6 @@ class Block:
api_name: Optional[AnyStr] = None,
js: Optional[str] = None,
no_target: bool = False,
status_tracker: Optional[StatusTracker] = None,
queue: Optional[bool] = None,
) -> None:
"""
@ -131,7 +130,6 @@ class Block:
api_name: Defining this parameter exposes the endpoint in the api docs
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
no_target: if True, sets "targets" to [], used for Blocks "load" event
status_tracker: StatusTracker to visualize function progress
Returns: None
"""
# Support for singular parameter
@ -160,9 +158,6 @@ class Block:
"outputs": [block._id for block in outputs],
"backend_fn": fn is not None,
"js": js,
"status_tracker": status_tracker._id
if status_tracker is not None
else None,
"queue": False if fn is None else queue,
"api_name": api_name,
"scroll_to_output": scroll_to_output,
@ -487,13 +482,10 @@ class Blocks(BlockContext):
dependency["outputs"] = [
original_mapping[o] for o in dependency["outputs"]
]
if dependency.get("status_tracker", None) is not None:
dependency["status_tracker"] = original_mapping[
dependency["status_tracker"]
]
dependency.pop("status_tracker", None)
dependency["_js"] = dependency.pop("js", None)
dependency["_preprocess"] = False
dependency["_postprocess"] = False
dependency["preprocess"] = False
dependency["postprocess"] = False
for target in targets:
event_method = getattr(original_mapping[target], trigger)

View File

@ -1488,8 +1488,8 @@ class Image(Editable, Clearable, Changeable, Streamable, IOComponent, ImgSeriali
outputs: List[Component],
_js: Optional[str] = None,
api_name: Optional[str] = None,
_preprocess: bool = True,
_postprocess: bool = True,
preprocess: bool = True,
postprocess: bool = True,
):
"""
This event is triggered when the user streams the component (e.g. a live webcam
@ -1509,8 +1509,8 @@ class Image(Editable, Clearable, Changeable, Streamable, IOComponent, ImgSeriali
outputs,
_js=_js,
api_name=api_name,
_preprocess=_preprocess,
_postprocess=_postprocess,
preprocess=preprocess,
postprocess=postprocess,
)
@ -1948,8 +1948,8 @@ class Audio(Changeable, Clearable, Playable, Streamable, IOComponent, FileSerial
outputs: List[Component],
_js: Optional[str] = None,
api_name: Optional[str] = None,
_preprocess: bool = True,
_postprocess: bool = True,
preprocess: bool = True,
postprocess: bool = True,
):
"""
This event is triggered when the user streams the component (e.g. a live webcam
@ -1971,8 +1971,8 @@ class Audio(Changeable, Clearable, Playable, Streamable, IOComponent, FileSerial
outputs,
_js=_js,
api_name=api_name,
_preprocess=_preprocess,
_postprocess=_postprocess,
preprocess=preprocess,
postprocess=postprocess,
)
def style(
@ -3291,7 +3291,7 @@ class Gallery(IOComponent):
def style(
self,
rounded: Optional[bool | Tuple[bool, bool, bool, bool]] = None,
grid: Optional[int | Tuple[int, int, int, int, int, int]] = None,
grid: Optional[int | Tuple] = None,
height: Optional[str] = None,
container: Optional[bool] = None,
):
@ -3299,6 +3299,7 @@ class Gallery(IOComponent):
This method can be used to change the appearance of the gallery component.
Parameters:
rounded: If True, will round the corners. If a tuple, will round corners according to the values in the tuple, starting from top left and proceeding clock-wise.
grid: Represents the number of images that should be shown in one row, for each of the six standard screen sizes (<576px, <768px, <992px, <1200px, <1400px, >1400px). if fewer that 6 are given then the last will be used for all subsequent breakpoints
height: Height of the gallery.
container: If True, will place gallery in a container - providing some extra padding around the border.
"""

View File

@ -1,5 +1,6 @@
from __future__ import annotations
import warnings
from typing import TYPE_CHECKING, Any, AnyStr, Callable, Dict, List, Optional, Tuple
from gradio.blocks import Block
@ -19,9 +20,9 @@ class Changeable(Block):
scroll_to_output: bool = False,
show_progress: bool = True,
queue: Optional[bool] = None,
preprocess: bool = True,
postprocess: bool = True,
_js: Optional[str] = None,
_preprocess: bool = True,
_postprocess: bool = True,
):
"""
This event is triggered when the component's input value changes (e.g. when the user types in a textbox
@ -32,26 +33,29 @@ class Changeable(Block):
inputs: List of inputs
outputs: List of outputs
api_name: Defining this parameter exposes the endpoint in the api docs
status_tracker: StatusTracker to visualize function progress
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
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.
"""
# _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.
# _preprocess: If False, will not run preprocessing of component data before running 'fn'.
# _postprocess: If False, will not run postprocessing of component data before returning 'fn' output.
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
self.set_event_trigger(
"change",
fn,
inputs,
outputs,
api_name=api_name,
status_tracker=status_tracker,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
js=_js,
preprocess=_preprocess,
postprocess=_postprocess,
preprocess=preprocess,
postprocess=postprocess,
queue=queue,
)
@ -67,9 +71,9 @@ class Clickable(Block):
scroll_to_output: bool = False,
show_progress: bool = True,
queue=None,
preprocess: bool = True,
postprocess: bool = True,
_js: Optional[str] = None,
_preprocess: bool = True,
_postprocess: bool = True,
):
"""
This event is triggered when the component (e.g. a button) is clicked.
@ -80,27 +84,30 @@ class Clickable(Block):
inputs: List of inputs
outputs: List of outputs
api_name: Defining this parameter exposes the endpoint in the api docs
status_tracker: StatusTracker to visualize function progress
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
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.
"""
# _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.
# _preprocess: If False, will not run preprocessing of component data before running 'fn'.
# _postprocess: If False, will not run postprocessing of component data before returning 'fn' output.
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
self.set_event_trigger(
"click",
fn,
inputs,
outputs,
api_name=api_name,
status_tracker=status_tracker,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
queue=queue,
js=_js,
preprocess=_preprocess,
postprocess=_postprocess,
preprocess=preprocess,
postprocess=postprocess,
)
@ -115,9 +122,9 @@ class Submittable(Block):
scroll_to_output: bool = False,
show_progress: bool = True,
queue: Optional[bool] = None,
preprocess: bool = True,
postprocess: bool = True,
_js: Optional[str] = None,
_preprocess: bool = True,
_postprocess: bool = True,
):
"""
This event is triggered when the user presses the Enter key while the component (e.g. a textbox) is focused.
@ -129,26 +136,29 @@ class Submittable(Block):
inputs: List of inputs
outputs: List of outputs
api_name: Defining this parameter exposes the endpoint in the api docs
status_tracker: StatusTracker to visualize function progress
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
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.
"""
# _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.
# _preprocess: If False, will not run preprocessing of component data before running 'fn'.
# _postprocess: If False, will not run postprocessing of component data before returning 'fn' output.
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
self.set_event_trigger(
"submit",
fn,
inputs,
outputs,
status_tracker=status_tracker,
api_name=api_name,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
js=_js,
preprocess=_preprocess,
postprocess=_postprocess,
preprocess=preprocess,
postprocess=postprocess,
queue=queue,
)
@ -160,10 +170,13 @@ class Editable(Block):
inputs: List[Component],
outputs: List[Component],
api_name: AnyStr = None,
status_tracker: Optional[StatusTracker] = None,
scroll_to_output: bool = False,
show_progress: bool = True,
queue: Optional[bool] = None,
preprocess: bool = True,
postprocess: bool = True,
_js: Optional[str] = None,
_preprocess: bool = True,
_postprocess: bool = True,
):
"""
This event is triggered when the user edits the component (e.g. image) using the
@ -174,20 +187,29 @@ class Editable(Block):
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
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.
"""
# _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.
# _preprocess: If False, will not run preprocessing of component data before running 'fn'.
# _postprocess: If False, will not run postprocessing of component data before returning 'fn' output.
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
self.set_event_trigger(
"edit",
fn,
inputs,
outputs,
api_name=api_name,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
js=_js,
preprocess=_preprocess,
postprocess=_postprocess,
preprocess=preprocess,
postprocess=postprocess,
queue=queue,
)
@ -199,10 +221,13 @@ class Clearable(Block):
inputs: List[Component],
outputs: List[Component],
api_name: AnyStr = None,
status_tracker: Optional[StatusTracker] = None,
scroll_to_output: bool = False,
show_progress: bool = True,
queue: Optional[bool] = None,
preprocess: bool = True,
postprocess: bool = True,
_js: Optional[str] = None,
_preprocess: bool = True,
_postprocess: bool = True,
):
"""
This event is triggered when the user clears the component (e.g. image or audio)
@ -213,20 +238,29 @@ class Clearable(Block):
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
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.
"""
# _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.
# _preprocess: If False, will not run preprocessing of component data before running 'fn'.
# _postprocess: If False, will not run postprocessing of component data before returning 'fn' output.
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
self.set_event_trigger(
"submit",
fn,
inputs,
outputs,
api_name=api_name,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
js=_js,
preprocess=_preprocess,
postprocess=_postprocess,
preprocess=preprocess,
postprocess=postprocess,
queue=queue,
)
@ -238,10 +272,13 @@ class Playable(Block):
inputs: List[Component],
outputs: List[Component],
api_name: AnyStr = None,
status_tracker: Optional[StatusTracker] = None,
scroll_to_output: bool = False,
show_progress: bool = True,
queue: Optional[bool] = None,
preprocess: bool = True,
postprocess: bool = True,
_js: Optional[str] = None,
_preprocess: bool = True,
_postprocess: bool = True,
):
"""
This event is triggered when the user plays the component (e.g. audio or video).
@ -252,20 +289,29 @@ class Playable(Block):
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
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.
"""
# _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.
# _preprocess: If False, will not run preprocessing of component data before running 'fn'.
# _postprocess: If False, will not run postprocessing of component data before returning 'fn' output.
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
self.set_event_trigger(
"play",
fn,
inputs,
outputs,
api_name=api_name,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
js=_js,
preprocess=_preprocess,
postprocess=_postprocess,
preprocess=preprocess,
postprocess=postprocess,
queue=queue,
)
@ -275,10 +321,13 @@ class Playable(Block):
inputs: List[Component],
outputs: List[Component],
api_name: Optional[AnyStr] = None,
status_tracker: Optional[StatusTracker] = None,
scroll_to_output: bool = False,
show_progress: bool = True,
queue: Optional[bool] = None,
preprocess: bool = True,
postprocess: bool = True,
_js: Optional[str] = None,
_preprocess: bool = True,
_postprocess: bool = True,
):
"""
This event is triggered when the user pauses the component (e.g. audio or video).
@ -289,20 +338,29 @@ class Playable(Block):
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
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.
"""
# _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.
# _preprocess: If False, will not run preprocessing of component data before running 'fn'.
# _postprocess: If False, will not run postprocessing of component data before returning 'fn' output.
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
self.set_event_trigger(
"pause",
fn,
inputs,
outputs,
api_name=api_name,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
js=_js,
preprocess=_preprocess,
postprocess=_postprocess,
preprocess=preprocess,
postprocess=postprocess,
queue=queue,
)
@ -312,10 +370,13 @@ class Playable(Block):
inputs: List[Component],
outputs: List[Component],
api_name: AnyStr = None,
status_tracker: Optional[StatusTracker] = None,
scroll_to_output: bool = False,
show_progress: bool = True,
queue: Optional[bool] = None,
preprocess: bool = True,
postprocess: bool = True,
_js: Optional[str] = None,
_preprocess: bool = True,
_postprocess: bool = True,
):
"""
This event is triggered when the user stops the component (e.g. audio or video).
@ -326,20 +387,29 @@ class Playable(Block):
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
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.
"""
# _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.
# _preprocess: If False, will not run preprocessing of component data before running 'fn'.
# _postprocess: If False, will not run postprocessing of component data before returning 'fn' output.
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
self.set_event_trigger(
"stop",
fn,
inputs,
outputs,
api_name=api_name,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
js=_js,
preprocess=_preprocess,
postprocess=_postprocess,
preprocess=preprocess,
postprocess=postprocess,
queue=queue,
)
@ -351,11 +421,13 @@ class Streamable(Block):
inputs: List[Component],
outputs: List[Component],
api_name: AnyStr = None,
show_progress: bool = False,
status_tracker: Optional[StatusTracker] = None,
scroll_to_output: bool = False,
show_progress: bool = True,
queue: Optional[bool] = None,
preprocess: bool = True,
postprocess: bool = True,
_js: Optional[str] = None,
_preprocess: bool = True,
_postprocess: bool = True,
):
"""
This event is triggered when the user streams the component (e.g. a live webcam
@ -366,21 +438,30 @@ class Streamable(Block):
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
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.
"""
# _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.
# _preprocess: If False, will not run preprocessing of component data before running 'fn'.
# _postprocess: If False, will not run postprocessing of component data before returning 'fn' output.
self.streaming = True
if status_tracker:
warnings.warn(
"The 'status_tracker' parameter has been deprecated and has no effect."
)
self.set_event_trigger(
"stream",
fn,
inputs,
outputs,
api_name=api_name,
scroll_to_output=scroll_to_output,
show_progress=show_progress,
js=_js,
preprocess=_preprocess,
postprocess=_postprocess,
preprocess=preprocess,
postprocess=postprocess,
queue=queue,
show_progress=False,
)

View File

@ -222,7 +222,7 @@ class Examples:
inputs=[self.dataset],
outputs=self.inputs_with_examples
+ (self.outputs if self.cache_examples else []),
_postprocess=False,
postprocess=False,
queue=False,
)
if self.run_on_click and not self.cache_examples:

View File

@ -456,11 +456,6 @@ class Interface(Blocks):
]:
with Column(variant="panel"):
input_component_column = Column()
if self.interface_type in [
self.InterfaceTypes.INPUT_ONLY,
self.InterfaceTypes.UNIFIED,
]:
status_tracker = StatusTracker(cover_container=True)
with input_component_column:
for component in self.input_components:
component.render()
@ -490,7 +485,6 @@ class Interface(Blocks):
]:
with Column(variant="panel"):
status_tracker = StatusTracker(cover_container=True)
for component in self.output_components:
component.render()
with Row():
@ -509,9 +503,8 @@ class Interface(Blocks):
None,
self.output_components,
api_name="predict",
status_tracker=status_tracker,
_preprocess=not (self.api_mode),
_postprocess=not (self.api_mode),
preprocess=not (self.api_mode),
postprocess=not (self.api_mode),
)
else:
for component in self.input_components:
@ -522,8 +515,8 @@ class Interface(Blocks):
self.input_components,
self.output_components,
api_name="predict",
_preprocess=not (self.api_mode),
_postprocess=not (self.api_mode),
preprocess=not (self.api_mode),
postprocess=not (self.api_mode),
)
continue
else:
@ -538,8 +531,8 @@ class Interface(Blocks):
self.input_components,
self.output_components,
api_name="predict",
_preprocess=not (self.api_mode),
_postprocess=not (self.api_mode),
preprocess=not (self.api_mode),
postprocess=not (self.api_mode),
)
else:
submit_btn.click(
@ -548,9 +541,8 @@ class Interface(Blocks):
self.output_components,
api_name="predict",
scroll_to_output=True,
status_tracker=status_tracker,
_preprocess=not (self.api_mode),
_postprocess=not (self.api_mode),
preprocess=not (self.api_mode),
postprocess=not (self.api_mode),
)
clear_btn.click(
None,
@ -612,7 +604,7 @@ class Interface(Blocks):
flag_method,
inputs=flag_components,
outputs=[],
_preprocess=False,
preprocess=False,
queue=False,
)
@ -639,8 +631,7 @@ class Interface(Blocks):
inputs=self.input_components + self.output_components,
outputs=interpretation_set
+ [input_component_column, interpret_component_column],
status_tracker=status_tracker,
_preprocess=False,
preprocess=False,
)
if self.article:

View File

@ -186,7 +186,6 @@ XRAY_CONFIG = {
"outputs": [29],
"backend_fn": True,
"js": None,
"status_tracker": None,
"queue": None,
"api_name": None,
"scroll_to_output": False,
@ -199,7 +198,6 @@ XRAY_CONFIG = {
"outputs": [34],
"backend_fn": True,
"js": None,
"status_tracker": None,
"queue": None,
"api_name": None,
"scroll_to_output": False,
@ -212,7 +210,6 @@ XRAY_CONFIG = {
"outputs": [36],
"backend_fn": True,
"js": None,
"status_tracker": None,
"queue": None,
"api_name": None,
"scroll_to_output": False,
@ -418,7 +415,6 @@ XRAY_CONFIG_DIFF_IDS = {
"outputs": [7],
"backend_fn": True,
"js": None,
"status_tracker": None,
"queue": None,
"api_name": None,
"scroll_to_output": False,
@ -431,7 +427,6 @@ XRAY_CONFIG_DIFF_IDS = {
"outputs": [12],
"backend_fn": True,
"js": None,
"status_tracker": None,
"queue": None,
"api_name": None,
"scroll_to_output": False,
@ -444,7 +439,6 @@ XRAY_CONFIG_DIFF_IDS = {
"outputs": [141],
"backend_fn": True,
"js": None,
"status_tracker": None,
"queue": None,
"api_name": None,
"scroll_to_output": False,
@ -622,7 +616,6 @@ XRAY_CONFIG_WITH_MISTAKE = {
"trigger": "click",
"inputs": [2, 6],
"outputs": [7],
"status_tracker": None,
"api_name": None,
"scroll_to_output": False,
"show_progress": True,
@ -632,7 +625,6 @@ XRAY_CONFIG_WITH_MISTAKE = {
"trigger": "click",
"inputs": [2, 11],
"outputs": [12],
"status_tracker": None,
"api_name": None,
"scroll_to_output": False,
"show_progress": True,

View File

@ -255,10 +255,6 @@ def assert_configs_are_equivalent_besides_ids(
for o1, o2 in zip(d1.pop("outputs"), d2.pop("outputs")):
assert_same_components(o1, o2)
# status tracker is popped since we allow it to have different ids
d1.pop("status_tracker", None)
d2.pop("status_tracker", None)
assert d1 == d2, f"{d1} does not match {d2}"
return True

View File

@ -196,7 +196,6 @@ class TestAssertConfigsEquivalent(unittest.TestCase):
"outputs": [2],
"backend_fn": True,
"js": None,
"status_tracker": None,
"queue": None,
"api_name": "greet",
"scroll_to_output": False,

View File

@ -26,7 +26,6 @@ export interface Dependency {
scroll_to_output: boolean;
show_progress: boolean;
frontend_fn?: Function;
status_tracker: number | null;
status?: string;
queue: boolean | null;
api_name: string | null;