modelscope-studio 0.4.1__tar.gz → 0.4.2__tar.gz

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 (49) hide show
  1. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/PKG-INFO +1 -1
  2. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Chatbot/__init__.pyi +89 -85
  3. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Flow/__init__.pyi +55 -51
  4. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Lifecycle/__init__.pyi +55 -51
  5. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Markdown/__init__.pyi +38 -34
  6. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/MultimodalInput/__init__.pyi +123 -119
  7. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/WaterfallGallery/__init__.pyi +89 -85
  8. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/utils/process_links.py +2 -2
  9. modelscope_studio-0.4.2/backend/modelscope_studio/version.py +1 -0
  10. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/pyproject.toml +1 -1
  11. modelscope_studio-0.4.1/backend/modelscope_studio/version.py +0 -1
  12. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/.gitignore +0 -0
  13. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/LICENSE +0 -0
  14. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/README.md +0 -0
  15. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/__init__.py +0 -0
  16. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Chatbot/__init__.py +0 -0
  17. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Chatbot/llm_thinking_presets.py +0 -0
  18. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Chatbot/templates/component/index-D9i0iVhN.js +0 -0
  19. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Chatbot/templates/component/index.js +0 -0
  20. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Chatbot/templates/component/style.css +0 -0
  21. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Chatbot/templates/example/index.js +0 -0
  22. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Chatbot/templates/example/style.css +0 -0
  23. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Flow/__init__.py +0 -0
  24. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Flow/edge.py +0 -0
  25. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Flow/node.py +0 -0
  26. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Flow/node_schema.py +0 -0
  27. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Flow/templates/component/index.js +0 -0
  28. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Flow/templates/component/style.css +0 -0
  29. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Lifecycle/__init__.py +0 -0
  30. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Lifecycle/templates/component/index.js +0 -0
  31. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Lifecycle/templates/component/style.css +0 -0
  32. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Markdown/__init__.py +0 -0
  33. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Markdown/templates/component/index-D9i0iVhN.js +0 -0
  34. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Markdown/templates/component/index.js +0 -0
  35. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Markdown/templates/component/style.css +0 -0
  36. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Markdown/templates/example/index-D9i0iVhN.js +0 -0
  37. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Markdown/templates/example/index.js +0 -0
  38. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/Markdown/templates/example/style.css +0 -0
  39. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/MultimodalInput/__init__.py +0 -0
  40. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/MultimodalInput/templates/component/index.js +0 -0
  41. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/MultimodalInput/templates/component/style.css +0 -0
  42. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/MultimodalInput/templates/example/index.js +0 -0
  43. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/MultimodalInput/templates/example/style.css +0 -0
  44. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/WaterfallGallery/__init__.py +0 -0
  45. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/WaterfallGallery/templates/component/index.js +0 -0
  46. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/WaterfallGallery/templates/component/style.css +0 -0
  47. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/components/__init__.py +0 -0
  48. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/external.py +0 -0
  49. {modelscope_studio-0.4.1 → modelscope_studio-0.4.2}/backend/modelscope_studio/utils/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: modelscope_studio
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: A set of extension component, inluding components for conversational input and display in multimodal scenarios, as well as more components for vertical scenarios.
5
5
  Author-email: YOUR NAME <YOUREMAIL@domain.com>
6
6
  License-Expression: Apache-2.0
@@ -352,10 +352,14 @@ class ModelScopeChatbot(Component):
352
352
  "text": "Hello!!",
353
353
  "flushing": False
354
354
  }]]
355
+ from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
356
+ from gradio.blocks import Block
357
+ if TYPE_CHECKING:
358
+ from gradio.components import Timer
355
359
 
356
360
 
357
361
  def change(self,
358
- fn: Callable | None = None,
362
+ fn: Callable[..., Any] | None = None,
359
363
  inputs: Block | Sequence[Block] | set[Block] | None = None,
360
364
  outputs: Block | Sequence[Block] | None = None,
361
365
  api_name: str | None | Literal[False] = None,
@@ -376,28 +380,28 @@ class ModelScopeChatbot(Component):
376
380
  """
377
381
  Parameters:
378
382
  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.
379
- inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
380
- outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
381
- 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.
382
- scroll_to_output: If True, will scroll to output component on completion
383
- show_progress: If True, will show progress animation while pending
384
- 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.
385
- 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.
386
- max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
387
- 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).
388
- postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
389
- 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.
390
- 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.
391
- 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.
392
- 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.
393
- 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).
394
- 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.
383
+ inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
384
+ outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
385
+ 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.
386
+ scroll_to_output: if True, will scroll to output component on completion
387
+ 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
388
+ 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.
389
+ 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.
390
+ max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
391
+ 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).
392
+ postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
393
+ 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.
394
+ 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.
395
+ 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.
396
+ 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.
397
+ 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).
398
+ 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.
395
399
  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.
396
400
  """
397
401
  ...
398
402
 
399
403
  def select(self,
400
- fn: Callable | None = None,
404
+ fn: Callable[..., Any] | None = None,
401
405
  inputs: Block | Sequence[Block] | set[Block] | None = None,
402
406
  outputs: Block | Sequence[Block] | None = None,
403
407
  api_name: str | None | Literal[False] = None,
@@ -418,28 +422,28 @@ class ModelScopeChatbot(Component):
418
422
  """
419
423
  Parameters:
420
424
  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.
421
- inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
422
- outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
423
- 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.
424
- scroll_to_output: If True, will scroll to output component on completion
425
- show_progress: If True, will show progress animation while pending
426
- 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.
427
- 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.
428
- max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
429
- 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).
430
- postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
431
- 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.
432
- 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.
433
- 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.
434
- 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.
435
- 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).
436
- 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.
425
+ inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
426
+ outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
427
+ 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.
428
+ scroll_to_output: if True, will scroll to output component on completion
429
+ 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
430
+ 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.
431
+ 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.
432
+ max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
433
+ 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).
434
+ postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
435
+ 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.
436
+ 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.
437
+ 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.
438
+ 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.
439
+ 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).
440
+ 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.
437
441
  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.
438
442
  """
439
443
  ...
440
444
 
441
445
  def like(self,
442
- fn: Callable | None = None,
446
+ fn: Callable[..., Any] | None = None,
443
447
  inputs: Block | Sequence[Block] | set[Block] | None = None,
444
448
  outputs: Block | Sequence[Block] | None = None,
445
449
  api_name: str | None | Literal[False] = None,
@@ -460,28 +464,28 @@ class ModelScopeChatbot(Component):
460
464
  """
461
465
  Parameters:
462
466
  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.
463
- inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
464
- outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
465
- 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.
466
- scroll_to_output: If True, will scroll to output component on completion
467
- show_progress: If True, will show progress animation while pending
468
- 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.
469
- 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.
470
- max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
471
- 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).
472
- postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
473
- 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.
474
- 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.
475
- 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.
476
- 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.
477
- 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).
478
- 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.
467
+ inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
468
+ outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
469
+ 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.
470
+ scroll_to_output: if True, will scroll to output component on completion
471
+ 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
472
+ 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.
473
+ 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.
474
+ max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
475
+ 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).
476
+ postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
477
+ 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.
478
+ 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.
479
+ 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.
480
+ 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.
481
+ 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).
482
+ 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.
479
483
  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.
480
484
  """
481
485
  ...
482
486
 
483
487
  def flushed(self,
484
- fn: Callable | None = None,
488
+ fn: Callable[..., Any] | None = None,
485
489
  inputs: Block | Sequence[Block] | set[Block] | None = None,
486
490
  outputs: Block | Sequence[Block] | None = None,
487
491
  api_name: str | None | Literal[False] = None,
@@ -502,28 +506,28 @@ class ModelScopeChatbot(Component):
502
506
  """
503
507
  Parameters:
504
508
  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.
505
- inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
506
- outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
507
- 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.
508
- scroll_to_output: If True, will scroll to output component on completion
509
- show_progress: If True, will show progress animation while pending
510
- 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.
511
- 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.
512
- max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
513
- 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).
514
- postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
515
- 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.
516
- 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.
517
- 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.
518
- 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.
519
- 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).
520
- 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.
509
+ inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
510
+ outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
511
+ 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.
512
+ scroll_to_output: if True, will scroll to output component on completion
513
+ 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
514
+ 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.
515
+ 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.
516
+ max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
517
+ 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).
518
+ postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
519
+ 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.
520
+ 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.
521
+ 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.
522
+ 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.
523
+ 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).
524
+ 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.
521
525
  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.
522
526
  """
523
527
  ...
524
528
 
525
529
  def custom(self,
526
- fn: Callable | None = None,
530
+ fn: Callable[..., Any] | None = None,
527
531
  inputs: Block | Sequence[Block] | set[Block] | None = None,
528
532
  outputs: Block | Sequence[Block] | None = None,
529
533
  api_name: str | None | Literal[False] = None,
@@ -544,22 +548,22 @@ class ModelScopeChatbot(Component):
544
548
  """
545
549
  Parameters:
546
550
  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.
547
- inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
548
- outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
549
- 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.
550
- scroll_to_output: If True, will scroll to output component on completion
551
- show_progress: If True, will show progress animation while pending
552
- 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.
553
- 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.
554
- max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
555
- 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).
556
- postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
557
- 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.
558
- 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.
559
- 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.
560
- 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.
561
- 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).
562
- 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.
551
+ inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
552
+ outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
553
+ 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.
554
+ scroll_to_output: if True, will scroll to output component on completion
555
+ 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
556
+ 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.
557
+ 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.
558
+ max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
559
+ 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).
560
+ postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
561
+ 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.
562
+ 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.
563
+ 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.
564
+ 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.
565
+ 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).
566
+ 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.
563
567
  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.
564
568
  """
565
569
  ...
@@ -139,10 +139,14 @@ class ModelScopeFlow(Component):
139
139
 
140
140
  def example_inputs(self) -> Any:
141
141
  return {"nodes": [], "edges": []}
142
+ from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
143
+ from gradio.blocks import Block
144
+ if TYPE_CHECKING:
145
+ from gradio.components import Timer
142
146
 
143
147
 
144
148
  def change(self,
145
- fn: Callable | None = None,
149
+ fn: Callable[..., Any] | None = None,
146
150
  inputs: Block | Sequence[Block] | set[Block] | None = None,
147
151
  outputs: Block | Sequence[Block] | None = None,
148
152
  api_name: str | None | Literal[False] = None,
@@ -163,28 +167,28 @@ class ModelScopeFlow(Component):
163
167
  """
164
168
  Parameters:
165
169
  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.
166
- inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
167
- outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
168
- 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.
169
- scroll_to_output: If True, will scroll to output component on completion
170
- show_progress: If True, will show progress animation while pending
171
- 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.
172
- 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.
173
- max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
174
- 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).
175
- postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
176
- 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.
177
- 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.
178
- 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.
179
- 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.
180
- 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).
181
- 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.
170
+ inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
171
+ outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
172
+ 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.
173
+ scroll_to_output: if True, will scroll to output component on completion
174
+ 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
175
+ 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.
176
+ 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.
177
+ max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
178
+ 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).
179
+ postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
180
+ 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.
181
+ 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.
182
+ 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.
183
+ 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.
184
+ 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).
185
+ 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.
182
186
  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.
183
187
  """
184
188
  ...
185
189
 
186
190
  def data_change(self,
187
- fn: Callable | None = None,
191
+ fn: Callable[..., Any] | None = None,
188
192
  inputs: Block | Sequence[Block] | set[Block] | None = None,
189
193
  outputs: Block | Sequence[Block] | None = None,
190
194
  api_name: str | None | Literal[False] = None,
@@ -205,28 +209,28 @@ class ModelScopeFlow(Component):
205
209
  """
206
210
  Parameters:
207
211
  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.
208
- inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
209
- outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
210
- 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.
211
- scroll_to_output: If True, will scroll to output component on completion
212
- show_progress: If True, will show progress animation while pending
213
- 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.
214
- 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.
215
- max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
216
- 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).
217
- postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
218
- 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.
219
- 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.
220
- 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.
221
- 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.
222
- 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).
223
- 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.
212
+ inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
213
+ outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
214
+ 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.
215
+ scroll_to_output: if True, will scroll to output component on completion
216
+ 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
217
+ 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.
218
+ 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.
219
+ max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
220
+ 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).
221
+ postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
222
+ 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.
223
+ 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.
224
+ 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.
225
+ 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.
226
+ 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).
227
+ 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.
224
228
  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.
225
229
  """
226
230
  ...
227
231
 
228
232
  def custom(self,
229
- fn: Callable | None = None,
233
+ fn: Callable[..., Any] | None = None,
230
234
  inputs: Block | Sequence[Block] | set[Block] | None = None,
231
235
  outputs: Block | Sequence[Block] | None = None,
232
236
  api_name: str | None | Literal[False] = None,
@@ -247,22 +251,22 @@ class ModelScopeFlow(Component):
247
251
  """
248
252
  Parameters:
249
253
  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.
250
- inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
251
- outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
252
- 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.
253
- scroll_to_output: If True, will scroll to output component on completion
254
- show_progress: If True, will show progress animation while pending
255
- 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.
256
- 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.
257
- max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
258
- 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).
259
- postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
260
- 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.
261
- 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.
262
- 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.
263
- 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.
264
- 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).
265
- 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.
254
+ inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
255
+ outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
256
+ 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.
257
+ scroll_to_output: if True, will scroll to output component on completion
258
+ 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
259
+ 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.
260
+ 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.
261
+ max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
262
+ 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).
263
+ postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
264
+ 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.
265
+ 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.
266
+ 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.
267
+ 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.
268
+ 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).
269
+ 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.
266
270
  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.
267
271
  """
268
272
  ...