gradio-leaderboard 0.0.12rc0__py3-none-any.whl → 0.0.14__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. gradio_leaderboard/leaderboard.pyi +102 -72
  2. gradio_leaderboard/templates/component/Index-CzS_eGV6.js +34210 -0
  3. gradio_leaderboard/templates/component/_basePickBy-CPQEc5fh.js +151 -0
  4. gradio_leaderboard/templates/component/_baseUniq-DlEwemC3.js +615 -0
  5. gradio_leaderboard/templates/component/arc-4UNMf6Jv.js +83 -0
  6. gradio_leaderboard/templates/component/architectureDiagram-NQ2NVSRB-ClVp_eQQ.js +4629 -0
  7. gradio_leaderboard/templates/component/blockDiagram-PHRCVELO-CBZHEIQE.js +2255 -0
  8. gradio_leaderboard/templates/component/c4Diagram-6F6E4RAY-BcEP_NdH.js +1586 -0
  9. gradio_leaderboard/templates/component/channel-BK2Jce3b.js +5 -0
  10. gradio_leaderboard/templates/component/chunk-353BL4L5-D4dVjjbU.js +8 -0
  11. gradio_leaderboard/templates/component/chunk-67H74DCK-Dd9cOxfN.js +64 -0
  12. gradio_leaderboard/templates/component/chunk-6OLS64BW-CfumlcA2.js +1376 -0
  13. gradio_leaderboard/templates/component/chunk-AACKK3MU-4CpiDhxa.js +18 -0
  14. gradio_leaderboard/templates/component/chunk-BFAMUDN2-C6YyJRb4.js +8 -0
  15. gradio_leaderboard/templates/component/chunk-E2GYISFI-CbYUJnri.js +19 -0
  16. gradio_leaderboard/templates/component/chunk-QEP2MXWD-BYLoFCys.js +1380 -0
  17. gradio_leaderboard/templates/component/chunk-SKB7J2MH-DNiBnZKZ.js +19 -0
  18. gradio_leaderboard/templates/component/classDiagram-BGRH5UQR-BrG1RRX8.js +16 -0
  19. gradio_leaderboard/templates/component/classDiagram-v2-O24JOBDK-BrG1RRX8.js +16 -0
  20. gradio_leaderboard/templates/component/clone-BA6MvtJ3.js +8 -0
  21. gradio_leaderboard/templates/component/cytoscape.esm-Bdz5CrXX.js +18629 -0
  22. gradio_leaderboard/templates/component/dagre-FFZHY6LT-6RahWHGr.js +444 -0
  23. gradio_leaderboard/templates/component/defaultLocale-D7EN2tov.js +171 -0
  24. gradio_leaderboard/templates/component/diagram-3EMPZRKU-DtoOVTDy.js +526 -0
  25. gradio_leaderboard/templates/component/diagram-5UYTHUR4-MEp0H-U7.js +137 -0
  26. gradio_leaderboard/templates/component/diagram-ZTM2IBQH-22c5YuUh.js +217 -0
  27. gradio_leaderboard/templates/component/erDiagram-R3QVA2FD-DZp2MeDc.js +844 -0
  28. gradio_leaderboard/templates/component/flowDiagram-PKI6S5ZS-CfK9UZi3.js +1623 -0
  29. gradio_leaderboard/templates/component/ganttDiagram-EK5VF46D-waaD2Kup.js +2502 -0
  30. gradio_leaderboard/templates/component/gitGraphDiagram-GW3U2K7C-DJCAxNvz.js +699 -0
  31. gradio_leaderboard/templates/component/graph-CXm5uxKj.js +247 -0
  32. gradio_leaderboard/templates/component/index.js +2 -29469
  33. gradio_leaderboard/templates/component/infoDiagram-RLU2ROGC-_Rx9wF6U.js +24 -0
  34. gradio_leaderboard/templates/component/init-DjUOC4st.js +16 -0
  35. gradio_leaderboard/templates/component/journeyDiagram-EWQZEKCU-G-tt0noJ.js +836 -0
  36. gradio_leaderboard/templates/component/kanban-definition-ILFWEQ3N-2aHifLFR.js +718 -0
  37. gradio_leaderboard/templates/component/layout-DiZ88ySr.js +1324 -0
  38. gradio_leaderboard/templates/component/linear-D4M9Dm-w.js +259 -0
  39. gradio_leaderboard/templates/component/mermaid.core-D36e06XD.js +14941 -0
  40. gradio_leaderboard/templates/component/mindmap-definition-CZNETY7S-1Jow2c7r.js +3215 -0
  41. gradio_leaderboard/templates/component/ordinal-DfAQgscy.js +61 -0
  42. gradio_leaderboard/templates/component/pieDiagram-NIOCPIFQ-DU7jHSoi.js +162 -0
  43. gradio_leaderboard/templates/component/quadrantDiagram-2OG54O6I-GcojS_If.js +1028 -0
  44. gradio_leaderboard/templates/component/requirementDiagram-SO3GGRV7-CBRyajan.js +853 -0
  45. gradio_leaderboard/templates/component/sankeyDiagram-4UZDY2LN-CeZji6oR.js +820 -0
  46. gradio_leaderboard/templates/component/sequenceDiagram-ZIKVLSP4-DMygkr3Y.js +2284 -0
  47. gradio_leaderboard/templates/component/stateDiagram-XX37X6EN-DK2vsx2r.js +263 -0
  48. gradio_leaderboard/templates/component/stateDiagram-v2-GD6S3NHB-BoIkPrjk.js +16 -0
  49. gradio_leaderboard/templates/component/style.css +1 -1
  50. gradio_leaderboard/templates/component/timeline-definition-RI47OAVP-BQ_Jr8hZ.js +797 -0
  51. gradio_leaderboard/templates/component/treemap-FKARHQ26-2Ty0RcZX.js +12981 -0
  52. gradio_leaderboard/templates/component/xychartDiagram-H2YORKM3--C9dwTwV.js +1368 -0
  53. gradio_leaderboard/templates/example/index.js +201 -139
  54. {gradio_leaderboard-0.0.12rc0.dist-info → gradio_leaderboard-0.0.14.dist-info}/METADATA +3 -3
  55. gradio_leaderboard-0.0.14.dist-info/RECORD +59 -0
  56. {gradio_leaderboard-0.0.12rc0.dist-info → gradio_leaderboard-0.0.14.dist-info}/WHEEL +1 -1
  57. gradio_leaderboard/templates/component/__vite-browser-external-2447137e.js +0 -4
  58. gradio_leaderboard/templates/component/wrapper-6f348d45-19fa94bf.js +0 -2453
  59. gradio_leaderboard-0.0.12rc0.dist-info/RECORD +0 -12
@@ -5,7 +5,12 @@ from __future__ import annotations
5
5
  import warnings
6
6
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union, Literal
7
7
 
8
- from pandas.api.types import is_numeric_dtype, is_object_dtype, is_string_dtype
8
+ from pandas.api.types import (
9
+ is_numeric_dtype,
10
+ is_object_dtype,
11
+ is_string_dtype,
12
+ is_bool_dtype,
13
+ )
9
14
  import semantic_version
10
15
  from dataclasses import dataclass, field
11
16
 
@@ -39,13 +44,12 @@ class SelectColumns:
39
44
  @dataclass
40
45
  class ColumnFilter:
41
46
  column: str
42
- type: Literal["slider", "dropdown", "checkboxgroup"] = None
47
+ type: Literal["slider", "dropdown", "checkboxgroup", "boolean"] = None
43
48
  default: Optional[Union[int, float, List[Tuple[str, str]]]] = None
44
49
  choices: Optional[Union[int, float, List[Tuple[str, str]]]] = None
45
50
  label: Optional[str] = None
46
51
  info: Optional[str] = None
47
52
  show_label: bool = True
48
- greater_than: bool = True
49
53
  min: Optional[Union[int, float]] = None
50
54
  max: Optional[Union[int, float]] = None
51
55
 
@@ -397,130 +401,156 @@ class Leaderboard(Component):
397
401
 
398
402
  def example_value(self) -> Any:
399
403
  return {"headers": ["a", "b"], "data": [["foo", "bar"]]}
404
+ from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
405
+ from gradio.blocks import Block
406
+ if TYPE_CHECKING:
407
+ from gradio.components import Timer
408
+ from gradio.components.base import Component
400
409
 
401
410
 
402
411
  def change(self,
403
- fn: Callable | None,
404
- inputs: Component | Sequence[Component] | set[Component] | None = None,
405
- outputs: Component | Sequence[Component] | None = None,
412
+ fn: Callable[..., Any] | None = None,
413
+ inputs: Block | Sequence[Block] | set[Block] | None = None,
414
+ outputs: Block | Sequence[Block] | None = None,
406
415
  api_name: str | None | Literal[False] = None,
407
416
  scroll_to_output: bool = False,
408
417
  show_progress: Literal["full", "minimal", "hidden"] = "full",
418
+ show_progress_on: Component | Sequence[Component] | None = None,
409
419
  queue: bool | None = None,
410
420
  batch: bool = False,
411
421
  max_batch_size: int = 4,
412
422
  preprocess: bool = True,
413
423
  postprocess: bool = True,
414
424
  cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
415
- every: float | None = None,
425
+ every: Timer | float | None = None,
416
426
  trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
417
- js: str | None = None,
427
+ js: str | Literal[True] | None = None,
418
428
  concurrency_limit: int | None | Literal["default"] = "default",
419
429
  concurrency_id: str | None = None,
420
- show_api: bool = True) -> Dependency:
430
+ show_api: bool = True,
431
+ key: int | str | tuple[int | str, ...] | None = None,
432
+
433
+ ) -> Dependency:
421
434
  """
422
435
  Parameters:
423
436
  fn: the function to call when this event is triggered. 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.
424
- inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
425
- outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
426
- api_name: Defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name.
427
- scroll_to_output: If True, will scroll to output component on completion
428
- show_progress: If True, will show progress animation while pending
429
- queue: If True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
430
- 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.
431
- max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
432
- 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).
433
- postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
434
- cancels: A list of other events to cancel when this listener 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. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
435
- every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds.
436
- trigger_mode: If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` and `.key_up()` events) would allow a second submission after the pending event is complete.
437
- 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.
438
- concurrency_limit: If set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
439
- concurrency_id: If set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit.
440
- show_api: whether to show this event in the "view API" page of the Gradio app, or in the ".view_api()" method of the Gradio clients. Unlike setting api_name to False, setting show_api to False will still allow downstream apps to use this event. If fn is None, show_api will automatically be set to False.
437
+ inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
438
+ outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
439
+ api_name: defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, will use the functions name as the endpoint route. If set to a string, the endpoint will be exposed in the api docs with the given name.
440
+ scroll_to_output: if True, will scroll to output component on completion
441
+ show_progress: how to show the progress animation while event is running: "full" shows a spinner which covers the output component area as well as a runtime display in the upper right corner, "minimal" only shows the runtime display, "hidden" shows no progress animation at all
442
+ show_progress_on: Component or list of components to show the progress animation on. If None, will show the progress animation on all of the output components.
443
+ queue: if True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
444
+ 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.
445
+ max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
446
+ 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).
447
+ postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
448
+ cancels: a list of other events to cancel when this listener 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. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
449
+ every: continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer.
450
+ trigger_mode: if "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` and `.key_up()` events) would allow a second submission after the pending event is complete.
451
+ 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.
452
+ concurrency_limit: if set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
453
+ concurrency_id: if set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit.
454
+ show_api: whether to show this event in the "view API" page of the Gradio app, or in the ".view_api()" method of the Gradio clients. Unlike setting api_name to False, setting show_api to False will still allow downstream apps as well as the Clients to use this event. If fn is None, show_api will automatically be set to False.
455
+ key: A unique key for this event listener to be used in @gr.render(). If set, this value identifies an event as identical across re-renders when the key is identical.
456
+
441
457
  """
442
458
  ...
443
459
 
444
460
  def input(self,
445
- fn: Callable | None,
446
- inputs: Component | Sequence[Component] | set[Component] | None = None,
447
- outputs: Component | Sequence[Component] | None = None,
461
+ fn: Callable[..., Any] | None = None,
462
+ inputs: Block | Sequence[Block] | set[Block] | None = None,
463
+ outputs: Block | Sequence[Block] | None = None,
448
464
  api_name: str | None | Literal[False] = None,
449
465
  scroll_to_output: bool = False,
450
466
  show_progress: Literal["full", "minimal", "hidden"] = "full",
467
+ show_progress_on: Component | Sequence[Component] | None = None,
451
468
  queue: bool | None = None,
452
469
  batch: bool = False,
453
470
  max_batch_size: int = 4,
454
471
  preprocess: bool = True,
455
472
  postprocess: bool = True,
456
473
  cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
457
- every: float | None = None,
474
+ every: Timer | float | None = None,
458
475
  trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
459
- js: str | None = None,
476
+ js: str | Literal[True] | None = None,
460
477
  concurrency_limit: int | None | Literal["default"] = "default",
461
478
  concurrency_id: str | None = None,
462
- show_api: bool = True) -> Dependency:
479
+ show_api: bool = True,
480
+ key: int | str | tuple[int | str, ...] | None = None,
481
+
482
+ ) -> Dependency:
463
483
  """
464
484
  Parameters:
465
485
  fn: the function to call when this event is triggered. 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.
466
- inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
467
- outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
468
- api_name: Defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name.
469
- scroll_to_output: If True, will scroll to output component on completion
470
- show_progress: If True, will show progress animation while pending
471
- queue: If True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
472
- 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.
473
- max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
474
- 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).
475
- postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
476
- cancels: A list of other events to cancel when this listener 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. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
477
- every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds.
478
- trigger_mode: If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` and `.key_up()` events) would allow a second submission after the pending event is complete.
479
- 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.
480
- concurrency_limit: If set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
481
- concurrency_id: If set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit.
482
- show_api: whether to show this event in the "view API" page of the Gradio app, or in the ".view_api()" method of the Gradio clients. Unlike setting api_name to False, setting show_api to False will still allow downstream apps to use this event. If fn is None, show_api will automatically be set to False.
486
+ inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
487
+ outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
488
+ api_name: defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, will use the functions name as the endpoint route. If set to a string, the endpoint will be exposed in the api docs with the given name.
489
+ scroll_to_output: if True, will scroll to output component on completion
490
+ show_progress: how to show the progress animation while event is running: "full" shows a spinner which covers the output component area as well as a runtime display in the upper right corner, "minimal" only shows the runtime display, "hidden" shows no progress animation at all
491
+ show_progress_on: Component or list of components to show the progress animation on. If None, will show the progress animation on all of the output components.
492
+ queue: if True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
493
+ 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.
494
+ max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
495
+ 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).
496
+ postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
497
+ cancels: a list of other events to cancel when this listener 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. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
498
+ every: continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer.
499
+ trigger_mode: if "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` and `.key_up()` events) would allow a second submission after the pending event is complete.
500
+ 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.
501
+ concurrency_limit: if set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
502
+ concurrency_id: if set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit.
503
+ show_api: whether to show this event in the "view API" page of the Gradio app, or in the ".view_api()" method of the Gradio clients. Unlike setting api_name to False, setting show_api to False will still allow downstream apps as well as the Clients to use this event. If fn is None, show_api will automatically be set to False.
504
+ key: A unique key for this event listener to be used in @gr.render(). If set, this value identifies an event as identical across re-renders when the key is identical.
505
+
483
506
  """
484
507
  ...
485
508
 
486
509
  def select(self,
487
- fn: Callable | None,
488
- inputs: Component | Sequence[Component] | set[Component] | None = None,
489
- outputs: Component | Sequence[Component] | None = None,
510
+ fn: Callable[..., Any] | None = None,
511
+ inputs: Block | Sequence[Block] | set[Block] | None = None,
512
+ outputs: Block | Sequence[Block] | None = None,
490
513
  api_name: str | None | Literal[False] = None,
491
514
  scroll_to_output: bool = False,
492
515
  show_progress: Literal["full", "minimal", "hidden"] = "full",
516
+ show_progress_on: Component | Sequence[Component] | None = None,
493
517
  queue: bool | None = None,
494
518
  batch: bool = False,
495
519
  max_batch_size: int = 4,
496
520
  preprocess: bool = True,
497
521
  postprocess: bool = True,
498
522
  cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
499
- every: float | None = None,
523
+ every: Timer | float | None = None,
500
524
  trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
501
- js: str | None = None,
525
+ js: str | Literal[True] | None = None,
502
526
  concurrency_limit: int | None | Literal["default"] = "default",
503
527
  concurrency_id: str | None = None,
504
- show_api: bool = True) -> Dependency:
528
+ show_api: bool = True,
529
+ key: int | str | tuple[int | str, ...] | None = None,
530
+
531
+ ) -> Dependency:
505
532
  """
506
533
  Parameters:
507
534
  fn: the function to call when this event is triggered. 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.
508
- inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
509
- outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
510
- api_name: Defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name.
511
- scroll_to_output: If True, will scroll to output component on completion
512
- show_progress: If True, will show progress animation while pending
513
- queue: If True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
514
- 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.
515
- max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
516
- 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).
517
- postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
518
- cancels: A list of other events to cancel when this listener 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. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
519
- every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds.
520
- trigger_mode: If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` and `.key_up()` events) would allow a second submission after the pending event is complete.
521
- 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.
522
- concurrency_limit: If set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
523
- concurrency_id: If set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit.
524
- show_api: whether to show this event in the "view API" page of the Gradio app, or in the ".view_api()" method of the Gradio clients. Unlike setting api_name to False, setting show_api to False will still allow downstream apps to use this event. If fn is None, show_api will automatically be set to False.
535
+ inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
536
+ outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
537
+ api_name: defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, will use the functions name as the endpoint route. If set to a string, the endpoint will be exposed in the api docs with the given name.
538
+ scroll_to_output: if True, will scroll to output component on completion
539
+ show_progress: how to show the progress animation while event is running: "full" shows a spinner which covers the output component area as well as a runtime display in the upper right corner, "minimal" only shows the runtime display, "hidden" shows no progress animation at all
540
+ show_progress_on: Component or list of components to show the progress animation on. If None, will show the progress animation on all of the output components.
541
+ queue: if True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
542
+ 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.
543
+ max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
544
+ 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).
545
+ postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
546
+ cancels: a list of other events to cancel when this listener 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. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
547
+ every: continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer.
548
+ trigger_mode: if "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` and `.key_up()` events) would allow a second submission after the pending event is complete.
549
+ 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.
550
+ concurrency_limit: if set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
551
+ concurrency_id: if set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit.
552
+ show_api: whether to show this event in the "view API" page of the Gradio app, or in the ".view_api()" method of the Gradio clients. Unlike setting api_name to False, setting show_api to False will still allow downstream apps as well as the Clients to use this event. If fn is None, show_api will automatically be set to False.
553
+ key: A unique key for this event listener to be used in @gr.render(). If set, this value identifies an event as identical across re-renders when the key is identical.
554
+
525
555
  """
526
556
  ...