diff --git a/demo/blocks_flag/run.py b/demo/blocks_flag/run.py index 2083d39edf..a2579e0e73 100644 --- a/demo/blocks_flag/run.py +++ b/demo/blocks_flag/run.py @@ -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() diff --git a/demo/blocks_inputs/config.json b/demo/blocks_inputs/config.json index 2af2202d90..57ce97f4f5 100644 --- a/demo/blocks_inputs/config.json +++ b/demo/blocks_inputs/config.json @@ -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, diff --git a/demo/blocks_kinematics/config.json b/demo/blocks_kinematics/config.json index bd73c06cdb..67d1810ab1 100644 --- a/demo/blocks_kinematics/config.json +++ b/demo/blocks_kinematics/config.json @@ -118,7 +118,7 @@ ], "backend_fn": true, "js": null, - "status_tracker": null, + "": null, "queue": null, "api_name": null, "scroll_to_output": false, diff --git a/demo/blocks_page_load/config.json b/demo/blocks_page_load/config.json index ed57c2c198..7051c6e8ee 100644 --- a/demo/blocks_page_load/config.json +++ b/demo/blocks_page_load/config.json @@ -59,7 +59,6 @@ ], "backend_fn": true, "js": false, - "status_tracker": null, "queue": null, "api_name": null, "scroll_to_output": false, diff --git a/demo/blocks_simple_squares/config.json b/demo/blocks_simple_squares/config.json index 08f4178288..7f48639594 100644 --- a/demo/blocks_simple_squares/config.json +++ b/demo/blocks_simple_squares/config.json @@ -108,7 +108,6 @@ ], "backend_fn": true, "js": null, - "status_tracker": null, "queue": null } ] diff --git a/demo/blocks_xray/config.json b/demo/blocks_xray/config.json index d46cad7660..b4cdad3be5 100644 --- a/demo/blocks_xray/config.json +++ b/demo/blocks_xray/config.json @@ -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, diff --git a/demo/blocks_xray/run.py b/demo/blocks_xray/run.py index 9154cbd301..78b574bfb9 100644 --- a/demo/blocks_xray/run.py +++ b/demo/blocks_xray/run.py @@ -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__": diff --git a/demo/kitchen_sink/config.json b/demo/kitchen_sink/config.json index 56a6f02e1c..bfa47c0880 100644 --- a/demo/kitchen_sink/config.json +++ b/demo/kitchen_sink/config.json @@ -1071,7 +1071,7 @@ ], "backend_fn": true, "js": null, - "status_tracker": 42, + "status_tracker": null, "queue": null, "api_name": "predict", "scroll_to_output": true, diff --git a/demo/outbreak_forecast/config.json b/demo/outbreak_forecast/config.json index b9ceff7e07..102d543553 100644 --- a/demo/outbreak_forecast/config.json +++ b/demo/outbreak_forecast/config.json @@ -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, diff --git a/gradio/blocks.py b/gradio/blocks.py index 1da8d65c83..874cca7ea7 100644 --- a/gradio/blocks.py +++ b/gradio/blocks.py @@ -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) diff --git a/gradio/components.py b/gradio/components.py index 01cbd2db7a..62bede7870 100644 --- a/gradio/components.py +++ b/gradio/components.py @@ -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. """ diff --git a/gradio/events.py b/gradio/events.py index ffaf734539..225d2e66d5 100644 --- a/gradio/events.py +++ b/gradio/events.py @@ -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, ) diff --git a/gradio/examples.py b/gradio/examples.py index 9e0bc6bd8b..f668e9ac3f 100644 --- a/gradio/examples.py +++ b/gradio/examples.py @@ -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: diff --git a/gradio/interface.py b/gradio/interface.py index b3ef4ad86b..014913f4f4 100644 --- a/gradio/interface.py +++ b/gradio/interface.py @@ -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: diff --git a/gradio/test_data/blocks_configs.py b/gradio/test_data/blocks_configs.py index a647ef177d..982648b701 100644 --- a/gradio/test_data/blocks_configs.py +++ b/gradio/test_data/blocks_configs.py @@ -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, diff --git a/gradio/utils.py b/gradio/utils.py index f86e5aaecc..d917b7dc2e 100644 --- a/gradio/utils.py +++ b/gradio/utils.py @@ -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 diff --git a/test/test_utils.py b/test/test_utils.py index 5c2398bb37..cbaaeda0a0 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -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, diff --git a/ui/packages/app/src/components/types.ts b/ui/packages/app/src/components/types.ts index a49cf775f2..8eb4f7cefe 100644 --- a/ui/packages/app/src/components/types.ts +++ b/ui/packages/app/src/components/types.ts @@ -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;