mlclaw 0.1.0 → 0.2.2

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. package/.agents/skills/mlclaw/SKILL.md +70 -18
  2. package/Dockerfile +21 -4
  3. package/README.md +77 -24
  4. package/assets/hf-logo.svg +8 -0
  5. package/assets/hf-tooling/manifest.json +50 -0
  6. package/assets/hf-tooling/skills/hf-cli/SKILL.md +218 -0
  7. package/assets/hf-tooling/skills/hf-mem/SKILL.md +79 -0
  8. package/assets/hf-tooling/skills/huggingface-best/SKILL.md +134 -0
  9. package/assets/hf-tooling/skills/huggingface-datasets/SKILL.md +107 -0
  10. package/assets/hf-tooling/skills/huggingface-gradio/SKILL.md +298 -0
  11. package/assets/hf-tooling/skills/huggingface-gradio/examples.md +613 -0
  12. package/assets/hf-tooling/skills/huggingface-local-models/SKILL.md +113 -0
  13. package/assets/hf-tooling/skills/huggingface-local-models/references/hardware.md +38 -0
  14. package/assets/hf-tooling/skills/huggingface-local-models/references/hub-discovery.md +178 -0
  15. package/assets/hf-tooling/skills/huggingface-local-models/references/quantization.md +256 -0
  16. package/assets/hf-tooling/skills/huggingface-papers/SKILL.md +239 -0
  17. package/assets/hf-tooling/skills/huggingface-spaces/SKILL.md +239 -0
  18. package/assets/hf-tooling/skills/huggingface-spaces/references/buckets.md +89 -0
  19. package/assets/hf-tooling/skills/huggingface-spaces/references/debugging.md +236 -0
  20. package/assets/hf-tooling/skills/huggingface-spaces/references/gradio.md +200 -0
  21. package/assets/hf-tooling/skills/huggingface-spaces/references/grants.md +56 -0
  22. package/assets/hf-tooling/skills/huggingface-spaces/references/inference-providers.md +85 -0
  23. package/assets/hf-tooling/skills/huggingface-spaces/references/known-errors.md +232 -0
  24. package/assets/hf-tooling/skills/huggingface-spaces/references/requirements.md +169 -0
  25. package/assets/hf-tooling/skills/huggingface-spaces/references/zerogpu.md +349 -0
  26. package/assets/hf-tooling/skills/huggingface-tool-builder/SKILL.md +120 -0
  27. package/assets/hf-tooling/skills/huggingface-tool-builder/references/baseline_hf_api.py +57 -0
  28. package/assets/hf-tooling/skills/huggingface-tool-builder/references/baseline_hf_api.sh +40 -0
  29. package/assets/hf-tooling/skills/huggingface-tool-builder/references/baseline_hf_api.tsx +57 -0
  30. package/assets/hf-tooling/skills/huggingface-tool-builder/references/find_models_by_paper.sh +230 -0
  31. package/assets/hf-tooling/skills/huggingface-tool-builder/references/hf_enrich_models.sh +96 -0
  32. package/assets/hf-tooling/skills/huggingface-tool-builder/references/hf_model_card_frontmatter.sh +188 -0
  33. package/assets/hf-tooling/skills/huggingface-tool-builder/references/hf_model_papers_auth.sh +171 -0
  34. package/assets/hf-tooling/skills/huggingface-zerogpu/SKILL.md +289 -0
  35. package/assets/hf-tooling/skills/huggingface-zerogpu/references/concurrency.md +79 -0
  36. package/assets/hf-tooling/skills/huggingface-zerogpu/references/cuda-and-deps.md +66 -0
  37. package/assets/hf-tooling/skills/huggingface-zerogpu/references/how-quota-works.md +74 -0
  38. package/assets/hf-tooling/skills/huggingface-zerogpu/references/how-zerogpu-works.md +50 -0
  39. package/assets/hf-tooling/templates/.agents/mcp/huggingface.json +11 -0
  40. package/assets/hf-tooling/templates/.env.example +5 -0
  41. package/assets/hf-tooling/templates/examples/huggingface/README.md +16 -0
  42. package/assets/hf-tooling/templates/examples/huggingface/bucket-sync.md +19 -0
  43. package/assets/hf-tooling/templates/examples/huggingface/dataset-upload.py +22 -0
  44. package/assets/hf-tooling/templates/examples/huggingface/hf-discover.md +13 -0
  45. package/assets/hf-tooling/templates/examples/huggingface/runtime-inspection.py +9 -0
  46. package/assets/mlclaw-control-ui/assets/index-D2TFes32.js +9 -0
  47. package/assets/mlclaw-control-ui/assets/index-DP72PFuv.css +1 -0
  48. package/assets/mlclaw-control-ui/index.html +13 -0
  49. package/assets/mlclaw.svg +298 -124
  50. package/dist/hf-tooling-seed.js +261 -0
  51. package/dist/mlclaw-space-runtime.js +6746 -3321
  52. package/dist/mlclaw.mjs +428 -178
  53. package/entrypoint.sh +4 -0
  54. package/mlclaw.ps1 +4 -2
  55. package/mlclaw.sh +5 -3
  56. package/openclaw.default.json +1 -0
  57. package/package.json +16 -2
  58. package/space/README.md +32 -2
  59. package/tsconfig.json +3 -2
@@ -0,0 +1,298 @@
1
+ ---
2
+ name: huggingface-gradio
3
+ description: Build Gradio web UIs and demos in Python. Use when creating or editing Gradio apps, components, event listeners, layouts, or chatbots.
4
+ ---
5
+
6
+ # Gradio
7
+
8
+ Gradio is a Python library for building interactive web UIs and ML demos. This skill covers the core API, patterns, and examples.
9
+
10
+ ## Guides
11
+
12
+ Detailed guides on specific topics (read these when relevant):
13
+
14
+ - [Quickstart](https://www.gradio.app/guides/quickstart)
15
+ - [The Interface Class](https://www.gradio.app/guides/the-interface-class)
16
+ - [Blocks and Event Listeners](https://www.gradio.app/guides/blocks-and-event-listeners)
17
+ - [Controlling Layout](https://www.gradio.app/guides/controlling-layout)
18
+ - [More Blocks Features](https://www.gradio.app/guides/more-blocks-features)
19
+ - [Custom CSS and JS](https://www.gradio.app/guides/custom-CSS-and-JS)
20
+ - [Streaming Outputs](https://www.gradio.app/guides/streaming-outputs)
21
+ - [Streaming Inputs](https://www.gradio.app/guides/streaming-inputs)
22
+ - [Sharing Your App](https://www.gradio.app/guides/sharing-your-app)
23
+ - [Custom HTML Components](https://www.gradio.app/guides/custom-HTML-components)
24
+ - [Getting Started with the Python Client](https://www.gradio.app/guides/getting-started-with-the-python-client)
25
+ - [Getting Started with the JS Client](https://www.gradio.app/guides/getting-started-with-the-js-client)
26
+
27
+ ## Core Patterns
28
+
29
+ **Interface** (high-level): wraps a function with input/output components.
30
+
31
+ ```python
32
+ import gradio as gr
33
+
34
+ def greet(name):
35
+ return f"Hello {name}!"
36
+
37
+ gr.Interface(fn=greet, inputs="text", outputs="text").launch()
38
+ ```
39
+
40
+ **Blocks** (low-level): flexible layout with explicit event wiring.
41
+
42
+ ```python
43
+ import gradio as gr
44
+
45
+ with gr.Blocks() as demo:
46
+ name = gr.Textbox(label="Name")
47
+ output = gr.Textbox(label="Greeting")
48
+ btn = gr.Button("Greet")
49
+ btn.click(fn=lambda n: f"Hello {n}!", inputs=name, outputs=output)
50
+
51
+ demo.launch()
52
+ ```
53
+
54
+ **ChatInterface**: high-level wrapper for chatbot UIs.
55
+
56
+ ```python
57
+ import gradio as gr
58
+
59
+ def respond(message, history):
60
+ return f"You said: {message}"
61
+
62
+ gr.ChatInterface(fn=respond).launch()
63
+ ```
64
+
65
+ ## Key Component Signatures
66
+
67
+ ### `Textbox(value: str | I18nData | Callable | None = None, type: Literal['text', 'password', 'email'] = "text", lines: int = 1, max_lines: int | None = None, placeholder: str | I18nData | None = None, label: str | I18nData | None = None, info: str | I18nData | None = None, every: Timer | float | None = None, inputs: Component | Sequence[Component] | set[Component] | None = None, show_label: bool | None = None, container: bool = True, scale: int | None = None, min_width: int = 160, interactive: bool | None = None, visible: bool | Literal['hidden'] = True, elem_id: str | None = None, autofocus: bool = False, autoscroll: bool = True, elem_classes: list[str] | str | None = None, render: bool = True, key: int | str | tuple[int | str, ...] | None = None, preserved_by_key: list[str] | str | None = "value", text_align: Literal['left', 'right'] | None = None, rtl: bool = False, buttons: list[Literal['copy'] | Button] | None = None, max_length: int | None = None, submit_btn: str | bool | None = False, stop_btn: str | bool | None = False, html_attributes: InputHTMLAttributes | None = None)`
68
+ Creates a textarea for user to enter string input or display string output..
69
+
70
+ ### `Number(value: float | Callable | None = None, label: str | I18nData | None = None, placeholder: str | I18nData | None = None, info: str | I18nData | None = None, every: Timer | float | None = None, inputs: Component | Sequence[Component] | set[Component] | None = None, show_label: bool | None = None, container: bool = True, scale: int | None = None, min_width: int = 160, interactive: bool | None = None, visible: bool | Literal['hidden'] = True, elem_id: str | None = None, elem_classes: list[str] | str | None = None, render: bool = True, key: int | str | tuple[int | str, ...] | None = None, preserved_by_key: list[str] | str | None = "value", buttons: list[Button] | None = None, precision: int | None = None, minimum: float | None = None, maximum: float | None = None, step: float = 1)`
71
+ Creates a numeric field for user to enter numbers as input or display numeric output..
72
+
73
+ ### `Slider(minimum: float = 0, maximum: float = 100, value: float | Callable | None = None, step: float | None = None, precision: int | None = None, label: str | I18nData | None = None, info: str | I18nData | None = None, every: Timer | float | None = None, inputs: Component | Sequence[Component] | set[Component] | None = None, show_label: bool | None = None, container: bool = True, scale: int | None = None, min_width: int = 160, interactive: bool | None = None, visible: bool | Literal['hidden'] = True, elem_id: str | None = None, elem_classes: list[str] | str | None = None, render: bool = True, key: int | str | tuple[int | str, ...] | None = None, preserved_by_key: list[str] | str | None = "value", randomize: bool = False, buttons: list[Literal['reset']] | None = None)`
74
+ Creates a slider that ranges from {minimum} to {maximum} with a step size of {step}..
75
+
76
+ ### `Checkbox(value: bool | Callable = False, label: str | I18nData | None = None, info: str | I18nData | None = None, every: Timer | float | None = None, inputs: Component | Sequence[Component] | set[Component] | None = None, show_label: bool | None = None, container: bool = True, scale: int | None = None, min_width: int = 160, interactive: bool | None = None, visible: bool | Literal['hidden'] = True, elem_id: str | None = None, elem_classes: list[str] | str | None = None, render: bool = True, key: int | str | tuple[int | str, ...] | None = None, preserved_by_key: list[str] | str | None = "value", buttons: list[Button] | None = None)`
77
+ Creates a checkbox that can be set to `True` or `False`.
78
+
79
+ ### `Dropdown(choices: Sequence[str | int | float | tuple[str, str | int | float]] | None = None, value: str | int | float | Sequence[str | int | float] | Callable | DefaultValue | None = DefaultValue(), type: Literal['value', 'index'] = "value", multiselect: bool | None = None, allow_custom_value: bool = False, max_choices: int | None = None, filterable: bool = True, label: str | I18nData | None = None, info: str | I18nData | None = None, every: Timer | float | None = None, inputs: Component | Sequence[Component] | set[Component] | None = None, show_label: bool | None = None, container: bool = True, scale: int | None = None, min_width: int = 160, interactive: bool | None = None, visible: bool | Literal['hidden'] = True, elem_id: str | None = None, elem_classes: list[str] | str | None = None, render: bool = True, key: int | str | tuple[int | str, ...] | None = None, preserved_by_key: list[str] | str | None = "value", buttons: list[Button] | None = None)`
80
+ Creates a dropdown of choices from which a single entry or multiple entries can be selected (as an input component) or displayed (as an output component)..
81
+
82
+ ### `Radio(choices: Sequence[str | int | float | tuple[str, str | int | float]] | None = None, value: str | int | float | Callable | None = None, type: Literal['value', 'index'] = "value", label: str | I18nData | None = None, info: str | I18nData | None = None, every: Timer | float | None = None, inputs: Component | Sequence[Component] | set[Component] | None = None, show_label: bool | None = None, container: bool = True, scale: int | None = None, min_width: int = 160, interactive: bool | None = None, visible: bool | Literal['hidden'] = True, elem_id: str | None = None, elem_classes: list[str] | str | None = None, render: bool = True, key: int | str | tuple[int | str, ...] | None = None, preserved_by_key: list[str] | str | None = "value", rtl: bool = False, buttons: list[Button] | None = None)`
83
+ Creates a set of (string or numeric type) radio buttons of which only one can be selected..
84
+
85
+ ### `Image(value: str | PIL.Image.Image | np.ndarray | Callable | None = None, format: str = "webp", height: int | str | None = None, width: int | str | None = None, image_mode: Literal['1', 'L', 'P', 'RGB', 'RGBA', 'CMYK', 'YCbCr', 'LAB', 'HSV', 'I', 'F'] | None = "RGB", sources: list[Literal['upload', 'webcam', 'clipboard']] | Literal['upload', 'webcam', 'clipboard'] | None = None, type: Literal['numpy', 'pil', 'filepath'] = "numpy", label: str | I18nData | None = None, every: Timer | float | None = None, inputs: Component | Sequence[Component] | set[Component] | None = None, show_label: bool | None = None, buttons: list[Literal['download', 'share', 'fullscreen'] | Button] | None = None, container: bool = True, scale: int | None = None, min_width: int = 160, interactive: bool | None = None, visible: bool | Literal['hidden'] = True, streaming: bool = False, elem_id: str | None = None, elem_classes: list[str] | str | None = None, render: bool = True, key: int | str | tuple[int | str, ...] | None = None, preserved_by_key: list[str] | str | None = "value", webcam_options: WebcamOptions | None = None, placeholder: str | None = None, watermark: WatermarkOptions | None = None)`
86
+ Creates an image component that can be used to upload images (as an input) or display images (as an output)..
87
+
88
+ ### `Audio(value: str | Path | tuple[int, np.ndarray] | Callable | None = None, sources: list[Literal['upload', 'microphone']] | Literal['upload', 'microphone'] | None = None, type: Literal['numpy', 'filepath'] = "numpy", label: str | I18nData | None = None, every: Timer | float | None = None, inputs: Component | Sequence[Component] | set[Component] | None = None, show_label: bool | None = None, container: bool = True, scale: int | None = None, min_width: int = 160, interactive: bool | None = None, visible: bool | Literal['hidden'] = True, streaming: bool = False, elem_id: str | None = None, elem_classes: list[str] | str | None = None, render: bool = True, key: int | str | tuple[int | str, ...] | None = None, preserved_by_key: list[str] | str | None = "value", format: Literal['wav', 'mp3'] | None = None, autoplay: bool = False, editable: bool = True, buttons: list[Literal['download', 'share'] | Button] | None = None, waveform_options: WaveformOptions | dict | None = None, loop: bool = False, recording: bool = False, subtitles: str | Path | list[dict[str, Any]] | None = None, playback_position: float = 0)`
89
+ Creates an audio component that can be used to upload/record audio (as an input) or display audio (as an output)..
90
+
91
+ ### `Video(value: str | Path | Callable | None = None, format: str | None = None, sources: list[Literal['upload', 'webcam']] | Literal['upload', 'webcam'] | None = None, height: int | str | None = None, width: int | str | None = None, label: str | I18nData | None = None, every: Timer | float | None = None, inputs: Component | Sequence[Component] | set[Component] | None = None, show_label: bool | None = None, container: bool = True, scale: int | None = None, min_width: int = 160, interactive: bool | None = None, visible: bool | Literal['hidden'] = True, elem_id: str | None = None, elem_classes: list[str] | str | None = None, render: bool = True, key: int | str | tuple[int | str, ...] | None = None, preserved_by_key: list[str] | str | None = "value", webcam_options: WebcamOptions | None = None, include_audio: bool | None = None, autoplay: bool = False, buttons: list[Literal['download', 'share'] | Button] | None = None, loop: bool = False, streaming: bool = False, watermark: WatermarkOptions | None = None, subtitles: str | Path | list[dict[str, Any]] | None = None, playback_position: float = 0)`
92
+ Creates a video component that can be used to upload/record videos (as an input) or display videos (as an output).
93
+
94
+ ### `File(value: str | list[str] | Callable | None = None, file_count: Literal['single', 'multiple', 'directory'] = "single", file_types: list[str] | None = None, type: Literal['filepath', 'binary'] = "filepath", label: str | I18nData | None = None, every: Timer | float | None = None, inputs: Component | Sequence[Component] | set[Component] | None = None, show_label: bool | None = None, container: bool = True, scale: int | None = None, min_width: int = 160, height: int | str | float | None = None, interactive: bool | None = None, visible: bool | Literal['hidden'] = True, elem_id: str | None = None, elem_classes: list[str] | str | None = None, render: bool = True, key: int | str | tuple[int | str, ...] | None = None, preserved_by_key: list[str] | str | None = "value", allow_reordering: bool = False, buttons: list[Button] | None = None)`
95
+ Creates a file component that allows uploading one or more generic files (when used as an input) or displaying generic files or URLs for download (as output).
96
+
97
+ ### `Chatbot(value: list[MessageDict | Message] | Callable | None = None, label: str | I18nData | None = None, every: Timer | float | None = None, inputs: Component | Sequence[Component] | set[Component] | None = None, show_label: bool | None = None, container: bool = True, scale: int | None = None, min_width: int = 160, visible: bool | Literal['hidden'] = True, elem_id: str | None = None, elem_classes: list[str] | str | None = None, autoscroll: bool = True, render: bool = True, key: int | str | tuple[int | str, ...] | None = None, preserved_by_key: list[str] | str | None = "value", height: int | str | None = 400, resizable: bool = False, max_height: int | str | None = None, min_height: int | str | None = None, editable: Literal['user', 'all'] | None = None, latex_delimiters: list[dict[str, str | bool]] | None = None, rtl: bool = False, buttons: list[Literal['share', 'copy', 'copy_all'] | Button] | None = None, watermark: str | None = None, avatar_images: tuple[str | Path | None, str | Path | None] | None = None, sanitize_html: bool = True, render_markdown: bool = True, feedback_options: list[str] | tuple[str, ...] | None = ('Like', 'Dislike'), feedback_value: Sequence[str | None] | None = None, line_breaks: bool = True, layout: Literal['panel', 'bubble'] | None = None, placeholder: str | None = None, examples: list[ExampleMessage] | None = None, allow_file_downloads: <class 'inspect._empty'> = True, group_consecutive_messages: bool = True, allow_tags: list[str] | bool = True, reasoning_tags: list[tuple[str, str]] | None = None, like_user_message: bool = False)`
98
+ Creates a chatbot that displays user-submitted messages and responses.
99
+
100
+ ### `Button(value: str | I18nData | Callable = "Run", every: Timer | float | None = None, inputs: Component | Sequence[Component] | set[Component] | None = None, variant: Literal['primary', 'secondary', 'stop', 'huggingface'] = "secondary", size: Literal['sm', 'md', 'lg'] = "lg", icon: str | Path | None = None, link: str | None = None, link_target: Literal['_self', '_blank', '_parent', '_top'] = "_self", visible: bool | Literal['hidden'] = True, interactive: bool = True, elem_id: str | None = None, elem_classes: list[str] | str | None = None, render: bool = True, key: int | str | tuple[int | str, ...] | None = None, preserved_by_key: list[str] | str | None = "value", scale: int | None = None, min_width: int | None = None)`
101
+ Creates a button that can be assigned arbitrary .click() events.
102
+
103
+ ### `Markdown(value: str | I18nData | Callable | None = None, label: str | I18nData | None = None, every: Timer | float | None = None, inputs: Component | Sequence[Component] | set[Component] | None = None, show_label: bool | None = None, rtl: bool = False, latex_delimiters: list[dict[str, str | bool]] | None = None, visible: bool | Literal['hidden'] = True, elem_id: str | None = None, elem_classes: list[str] | str | None = None, render: bool = True, key: int | str | tuple[int | str, ...] | None = None, preserved_by_key: list[str] | str | None = "value", sanitize_html: bool = True, line_breaks: bool = False, header_links: bool = False, height: int | str | None = None, max_height: int | str | None = None, min_height: int | str | None = None, buttons: list[Literal['copy']] | None = None, container: bool = False, padding: bool = False)`
104
+ Used to render arbitrary Markdown output.
105
+
106
+ ### `HTML(value: Any | Callable | None = None, label: str | I18nData | None = None, html_template: str = "${value}", css_template: str = "", js_on_load: str | None = "element.addEventListener('click', function() { trigger('click') });", apply_default_css: bool = True, every: Timer | float | None = None, inputs: Component | Sequence[Component] | set[Component] | None = None, show_label: bool = False, visible: bool | Literal['hidden'] = True, elem_id: str | None = None, elem_classes: list[str] | str | None = None, render: bool = True, key: int | str | tuple[int | str, ...] | None = None, preserved_by_key: list[str] | str | None = "value", min_height: int | None = None, max_height: int | None = None, container: bool = False, padding: bool = False, autoscroll: bool = False, buttons: list[Button] | None = None, server_functions: list[Callable] | None = None, props: Any)`
107
+ Creates a component with arbitrary HTML.
108
+
109
+
110
+ ## Custom HTML Components
111
+
112
+ If a task requires significant customization of an existing component or a component that doesn't exist in Gradio, you can create one with `gr.HTML`. It supports `html_template` (with `${}` JS expressions and `{{}}` Handlebars syntax), `css_template` for scoped styles, and `js_on_load` for interactivity — where `props.value` updates the component value and `trigger('event_name')` fires Gradio events. For reuse, subclass `gr.HTML` and define `api_info()` for API/MCP support. See the [full guide](https://www.gradio.app/guides/custom-HTML-components).
113
+
114
+ Here's an example that shows how to create and use these kinds of components:
115
+
116
+ ```python
117
+ import gradio as gr
118
+
119
+ class StarRating(gr.HTML):
120
+ def __init__(self, label, value=0, **kwargs):
121
+ html_template = """
122
+ <h2>${label} rating:</h2>
123
+ ${Array.from({length: 5}, (_, i) => `<img class='${i < value ? '' : 'faded'}' src='https://upload.wikimedia.org/wikipedia/commons/d/df/Award-star-gold-3d.svg'>`).join('')}
124
+ """
125
+ css_template = """
126
+ img { height: 50px; display: inline-block; cursor: pointer; }
127
+ .faded { filter: grayscale(100%); opacity: 0.3; }
128
+ """
129
+ js_on_load = """
130
+ const imgs = element.querySelectorAll('img');
131
+ imgs.forEach((img, index) => {
132
+ img.addEventListener('click', () => {
133
+ props.value = index + 1;
134
+ });
135
+ });
136
+ """
137
+ super().__init__(value=value, label=label, html_template=html_template, css_template=css_template, js_on_load=js_on_load, **kwargs)
138
+
139
+ def api_info(self):
140
+ return {"type": "integer", "minimum": 0, "maximum": 5}
141
+
142
+
143
+ with gr.Blocks() as demo:
144
+ gr.Markdown("# Restaurant Review")
145
+ food_rating = StarRating(label="Food", value=3)
146
+ service_rating = StarRating(label="Service", value=3)
147
+ ambience_rating = StarRating(label="Ambience", value=3)
148
+ average_btn = gr.Button("Calculate Average Rating")
149
+ rating_output = StarRating(label="Average", value=3)
150
+ def calculate_average(food, service, ambience):
151
+ return round((food + service + ambience) / 3)
152
+ average_btn.click(
153
+ fn=calculate_average,
154
+ inputs=[food_rating, service_rating, ambience_rating],
155
+ outputs=rating_output
156
+ )
157
+
158
+ demo.launch()
159
+ ```
160
+
161
+ ## Event Listeners
162
+
163
+ All event listeners share the same signature:
164
+
165
+ ```python
166
+ component.event_name(
167
+ fn: Callable | None | Literal["decorator"] = "decorator",
168
+ inputs: Component | Sequence[Component] | set[Component] | None = None,
169
+ outputs: Component | Sequence[Component] | set[Component] | None = None,
170
+ api_name: str | None = None,
171
+ api_description: str | None | Literal[False] = None,
172
+ scroll_to_output: bool = False,
173
+ show_progress: Literal["full", "minimal", "hidden"] = "full",
174
+ show_progress_on: Component | Sequence[Component] | None = None,
175
+ queue: bool = True,
176
+ batch: bool = False,
177
+ max_batch_size: int = 4,
178
+ preprocess: bool = True,
179
+ postprocess: bool = True,
180
+ cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
181
+ trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
182
+ js: str | Literal[True] | None = None,
183
+ concurrency_limit: int | None | Literal["default"] = "default",
184
+ concurrency_id: str | None = None,
185
+ api_visibility: Literal["public", "private", "undocumented"] = "public",
186
+ time_limit: int | None = None,
187
+ stream_every: float = 0.5,
188
+ key: int | str | tuple[int | str, ...] | None = None,
189
+ validator: Callable | None = None,
190
+ ) -> Dependency
191
+ ```
192
+
193
+ Supported events per component:
194
+
195
+ - **AnnotatedImage**: select
196
+ - **Audio**: stream, change, clear, play, pause, stop, pause, start_recording, pause_recording, stop_recording, upload, input
197
+ - **BarPlot**: select, double_click
198
+ - **BrowserState**: change
199
+ - **Button**: click
200
+ - **Chatbot**: change, select, like, retry, undo, example_select, option_select, clear, copy, edit
201
+ - **Checkbox**: change, input, select
202
+ - **CheckboxGroup**: change, input, select
203
+ - **ClearButton**: click
204
+ - **Code**: change, input, focus, blur
205
+ - **ColorPicker**: change, input, submit, focus, blur
206
+ - **Dataframe**: change, input, select, edit
207
+ - **Dataset**: click, select
208
+ - **DateTime**: change, submit
209
+ - **DeepLinkButton**: click
210
+ - **Dialogue**: change, input, submit
211
+ - **DownloadButton**: click
212
+ - **Dropdown**: change, input, select, focus, blur, key_up
213
+ - **DuplicateButton**: click
214
+ - **File**: change, select, clear, upload, delete, download
215
+ - **FileExplorer**: change, input, select
216
+ - **Gallery**: select, upload, change, delete, preview_close, preview_open
217
+ - **HTML**: change, input, click, double_click, submit, stop, edit, clear, play, pause, end, start_recording, pause_recording, stop_recording, focus, blur, upload, release, select, stream, like, example_select, option_select, load, key_up, apply, delete, tick, undo, retry, expand, collapse, download, copy
218
+ - **HighlightedText**: change, select
219
+ - **Image**: clear, change, stream, select, upload, input
220
+ - **ImageEditor**: clear, change, input, select, upload, apply
221
+ - **ImageSlider**: clear, change, stream, select, upload, input
222
+ - **JSON**: change
223
+ - **Label**: change, select
224
+ - **LinePlot**: select, double_click
225
+ - **LoginButton**: click
226
+ - **Markdown**: change, copy
227
+ - **Model3D**: change, upload, edit, clear
228
+ - **MultimodalTextbox**: change, input, select, submit, focus, blur, stop
229
+ - **Navbar**: change
230
+ - **Number**: change, input, submit, focus, blur
231
+ - **ParamViewer**: change, upload
232
+ - **Plot**: change
233
+ - **Radio**: select, change, input
234
+ - **ScatterPlot**: select, double_click
235
+ - **SimpleImage**: clear, change, upload
236
+ - **Slider**: change, input, release
237
+ - **State**: change
238
+ - **Textbox**: change, input, select, submit, focus, blur, stop, copy
239
+ - **Timer**: tick
240
+ - **UploadButton**: click, upload
241
+ - **Video**: change, clear, start_recording, stop_recording, stop, play, pause, end, upload, input
242
+
243
+ ## Prediction CLI
244
+
245
+ The `gradio` CLI includes `info` and `predict` commands for interacting with Gradio apps programmatically. These are especially useful for coding agents that need to use Spaces in their workflows.
246
+
247
+ ### `gradio info` — Discover endpoints and parameters
248
+
249
+ ```bash
250
+ gradio info <space_id_or_url>
251
+ ```
252
+
253
+ Returns a JSON payload describing all endpoints, their parameters (with types and defaults), and return values.
254
+
255
+ ```bash
256
+ gradio info gradio/calculator
257
+ # {
258
+ # "/predict": {
259
+ # "parameters": [
260
+ # {"name": "num1", "required": true, "default": null, "type": {"type": "number"}},
261
+ # {"name": "operation", "required": true, "default": null, "type": {"enum": ["add", "subtract", "multiply", "divide"], "type": "string"}},
262
+ # {"name": "num2", "required": true, "default": null, "type": {"type": "number"}}
263
+ # ],
264
+ # "returns": [{"name": "output", "type": {"type": "number"}}],
265
+ # "description": ""
266
+ # }
267
+ # }
268
+ ```
269
+
270
+ File-type parameters show `"type": "filepath"` with instructions to include `"meta": {"_type": "gradio.FileData"}` — this signals the file will be uploaded to the remote server.
271
+
272
+ ### `gradio predict` — Send predictions
273
+
274
+ ```bash
275
+ gradio predict <space_id_or_url> <endpoint> <json_payload>
276
+ ```
277
+
278
+ Returns a JSON object with named output keys.
279
+
280
+ ```bash
281
+ # Simple numeric prediction
282
+ gradio predict gradio/calculator /predict '{"num1": 5, "operation": "multiply", "num2": 3}'
283
+ # {"output": 15}
284
+
285
+ # Image generation
286
+ gradio predict black-forest-labs/FLUX.2-dev /infer '{"prompt": "A majestic dragon"}'
287
+ # {"Result": "/tmp/gradio/.../image.webp", "Seed": 1117868604}
288
+
289
+ # File upload (must include meta key)
290
+ gradio predict gradio/image_mod /predict '{"image": {"path": "/path/to/image.png", "meta": {"_type": "gradio.FileData"}}}'
291
+ # {"output": "/tmp/gradio/.../output.png"}
292
+ ```
293
+
294
+ Both commands accept `--token` for accessing private Spaces.
295
+
296
+ ## Additional Reference
297
+
298
+ - [End-to-End Examples](examples.md) — complete working apps