text stringlengths 0 2k | heading1 stringlengths 3 79 | source_page_url stringclasses 190
values | source_page_title stringclasses 190
values |
|---|---|---|---|
2'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%2... | launch | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
pp inline in an iframe. Defaults to True in
python notebooks; False otherwise.
inbrowser: bool
default `= False`
whether to automatically launch the gradio app in a new tab on the default
browser.
share: bool | None
default `= None`
whether to create a publicly shareable link for the... | launch | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
an alert modal and
printed in the browser console log. They will also be displayed in the alert
modal of downstream apps that gr.load() this app.
server_name: str | None
default `= None`
to make app accessible on local network, set this to "0.0.0.0". Can be set by
environment variable GRADIO_SERVER_NA... | launch | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
inks: list[Literal['api', 'gradio', 'settings', 'runs'] | dict[str, str]] | None
default `= None`
The links to display in the footer of the app. Accepts a list, where each
element of the list must be one of "api", "gradio", "settings", or "runs"
corresponding to the API docs, "built with Gradio", the settings page, a... | launch | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
ur app are not allowed to access). Must be absolute
paths. Warning: takes precedence over `allowed_paths` and all other
directories exposed by Gradio by default. Can be set by comma separated
environment variable GRADIO_BLOCKED_PATHS.
root_path: str | None
default `= None`
The root path (or "mount poi... | launch | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
ocol to use for the share links. Defaults to
"https", unless a custom share_server_address is provided, in which case it
defaults to "http". If you are using a custom share_server_address and want to
use https, you must set this to "https".
share_server_tls_certificate: str | None
default `= None`
The... | launch | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
erver
running on localhost. If False, allows requests to localhost that originate
from localhost but also, crucially, from "null". This parameter should
normally be True to prevent CSRF attacks but may need to be False when
embedding a *locally-running Gradio app* using web components.
node_server_name:... | launch | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
abels of components or Markdown strings).
This feature can only be used to translate static text in the frontend, not
values in the backend.
theme: Theme | str | None
default `= None`
A Theme object or a string representing a theme. If a string, will look for a
built-in theme with that name (e.g. "sof... | launch | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | load | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%203... | load | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
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.
inputs: Component | BlockContext | list[Component | BlockContext] | Set[Compo... | load | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
shows the runtime display, "hidden"
shows no progress animation at all
show_progress_on: Component | list[Component] | None
default `= None`
Component or list of components to show the progress animation on. If None,
will show the progress animation on all of the output components.
que... | load | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
ponents .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.
trigger_mode: Literal['once', 'multiple', 'always_last'] | None
default `= None`
If "once" (default for all events except `.c... | load | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
te" (hidden from API docs
and not callable by the Gradio client libraries), or "undocumented" (hidden
from API docs but callable by clients and via gr.load). If fn is None,
api_visibility will automatically be set to "private".
time_limit: int | None
default `= None`
stream_every: float... | load | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | from_pipeline | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
20640%20512'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5... | from_pipeline | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
/svg'%20fill='%23808080'%20viewBox='0%200%20640%20512'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%207... | from_pipeline | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
ne object to use.
| from_pipeline | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | integrate | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392... | integrate | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
ype | None
default `= None`
If the wandb module is provided, will integrate with it and appear on WandB
dashboard
mlflow: ModuleType | None
default `= None`
If the mlflow module is provided, will integrate with the experiment and
appear on ML Flow dashboard
| integrate | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | queue | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%2... | queue | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
ro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%20318.3L391.3%20319.9C381%... | queue | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
send status at regular intervals set by this
parameter as the number of seconds.
api_open: bool | None
default `= None`
If True, the REST routes of the backend will be open, allowing requests made
directly to those endpoints to skip the queue.
max_size: int | None
default `= None`
T... | queue | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | launch | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%... | launch | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
2'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%2... | launch | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
pp inline in an iframe. Defaults to True in
python notebooks; False otherwise.
inbrowser: bool
default `= False`
whether to automatically launch the gradio app in a new tab on the default
browser.
share: bool | None
default `= None`
whether to create a publicly shareable link for the... | launch | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
an alert modal and
printed in the browser console log. They will also be displayed in the alert
modal of downstream apps that gr.load() this app.
server_name: str | None
default `= None`
to make app accessible on local network, set this to "0.0.0.0". Can be set by
environment variable GRADIO_SERVER_NA... | launch | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
inks: list[Literal['api', 'gradio', 'settings', 'runs'] | dict[str, str]] | None
default `= None`
The links to display in the footer of the app. Accepts a list, where each
element of the list must be one of "api", "gradio", "settings", or "runs"
corresponding to the API docs, "built with Gradio", the settings page, a... | launch | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
ur app are not allowed to access). Must be absolute
paths. Warning: takes precedence over `allowed_paths` and all other
directories exposed by Gradio by default. Can be set by comma separated
environment variable GRADIO_BLOCKED_PATHS.
root_path: str | None
default `= None`
The root path (or "mount poi... | launch | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
ocol to use for the share links. Defaults to
"https", unless a custom share_server_address is provided, in which case it
defaults to "http". If you are using a custom share_server_address and want to
use https, you must set this to "https".
share_server_tls_certificate: str | None
default `= None`
The... | launch | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
erver
running on localhost. If False, allows requests to localhost that originate
from localhost but also, crucially, from "null". This parameter should
normally be True to prevent CSRF attacks but may need to be False when
embedding a *locally-running Gradio app* using web components.
node_server_name:... | launch | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
abels of components or Markdown strings).
This feature can only be used to translate static text in the frontend, not
values in the backend.
theme: Theme | str | None
default `= None`
A Theme object or a string representing a theme. If a string, will look for a
built-in theme with that name (e.g. "sof... | launch | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | load | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%203... | load | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
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.
inputs: Component | BlockContext | list[Component | BlockContext] | Set[Compo... | load | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
shows the runtime display, "hidden"
shows no progress animation at all
show_progress_on: Component | list[Component] | None
default `= None`
Component or list of components to show the progress animation on. If None,
will show the progress animation on all of the output components.
que... | load | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
ponents .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.
trigger_mode: Literal['once', 'multiple', 'always_last'] | None
default `= None`
If "once" (default for all events except `.c... | load | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
te" (hidden from API docs
and not callable by the Gradio client libraries), or "undocumented" (hidden
from API docs but callable by clients and via gr.load). If fn is None,
api_visibility will automatically be set to "private".
time_limit: int | None
default `= None`
stream_every: float... | load | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | from_pipeline | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
20640%20512'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5... | from_pipeline | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
/svg'%20fill='%23808080'%20viewBox='0%200%20640%20512'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%207... | from_pipeline | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
ne object to use.
| from_pipeline | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | integrate | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392... | integrate | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
ype | None
default `= None`
If the wandb module is provided, will integrate with it and appear on WandB
dashboard
mlflow: ModuleType | None
default `= None`
If the mlflow module is provided, will integrate with the experiment and
appear on ML Flow dashboard
| integrate | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | queue | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%2... | queue | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
ro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%20318.3L391.3%20319.9C381%... | queue | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
send status at regular intervals set by this
parameter as the number of seconds.
api_open: bool | None
default `= None`
If True, the REST routes of the backend will be open, allowing requests made
directly to those endpoints to skip the queue.
max_size: int | None
default `= None`
T... | queue | https://gradio.app/docs/gradio/interface | Gradio - Interface Docs |
Displays a classification label, along with confidence scores of top
categories, if provided. As this component does not accept user input, it is
rarely used as an input component.
| Description | https://gradio.app/docs/gradio/label | Gradio - Label Docs |
**Using Label as an input component.**
How Label will pass its value to your function:
Type: `dict[str, float] | str | int | float | None`
Depending on the value, passes the label as a `str | int | float`, or the labels and confidences as a `dict[str, float]`.
Example Code
import gradio ... | Behavior | https://gradio.app/docs/gradio/label | Gradio - Label Docs |
Parameters ▼
value: dict[str, float] | str | float | Callable | None
default `= None`
Default value to show in the component. If a str or number is provided, simply
displays the string or number. If a {Dict[str, float]} of classes and
confidences is provided, displays the top class on top and the
`num... | Initialization | https://gradio.app/docs/gradio/label | Gradio - Label Docs |
if Components A and
B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide
as B. Should be an integer. scale applies in Rows, and to top-level Components
in Blocks where fill_height=True.
min_width: int
default `= 160`
minimum pixel width, will wrap if not sufficient screen spa... | Initialization | https://gradio.app/docs/gradio/label | Gradio - Label Docs |
ameters will be preserved in the UI (if they have been changed by
the user or an event listener) instead of re-rendered based on the values
provided during constructor.
color: str | None
default `= None`
The background color of the label (either a valid css color name or
hexadecimal string).
... | Initialization | https://gradio.app/docs/gradio/label | Gradio - Label Docs |
Shortcuts
gradio.Label
Interface String Shortcut `"label"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/label | Gradio - Label Docs |
Description
Event listeners allow you to respond to user interactions with the UI
components you've defined in a Gradio Blocks app. When a user interacts with
an element, such as changing a slider value or uploading an image, a function
is called.
Supported Event Listeners
The Label component supports the following ... | Event Listeners | https://gradio.app/docs/gradio/label | Gradio - Label Docs |
| BlockContext | list[Component | BlockContext] | Set[Component | BlockContext] | None
default `= None`
List of gradio.components to use as outputs. If the function returns no
outputs, this should be an empty list.
api_name: str | None
default `= None`
defines how the endpoint appears in the API do... | Event Listeners | https://gradio.app/docs/gradio/label | Gradio - Label Docs |
If None, will use the queue setting of the gradio app.
batch: bool
default `= False`
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 fu... | Event Listeners | https://gradio.app/docs/gradio/label | Gradio - Label Docs |
.key_up()` events) would allow a second submission after the
pending event is complete.
js: str | Literal[True] | None
default `= None`
Optional frontend JavaScript to run before 'fn', provided as either a function
or a raw code string. A function receives the values of 'inputs' and 'outputs'
as argum... | Event Listeners | https://gradio.app/docs/gradio/label | Gradio - Label Docs |
ifies an event as identical across re-renders when the key is
identical.
validator: Callable | None
default `= None`
Optional validation function to run before the main function. If provided,
this function will be executed first with queue=False, and only if it
completes successfully will the main fun... | Event Listeners | https://gradio.app/docs/gradio/label | Gradio - Label Docs |
Creates a color picker for user to select a color as string input. Can be
used as an input to pass a color value to a function or as an output to
display a color value.
| Description | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
**Using ColorPicker as an input component.**
How ColorPicker will pass its value to your function:
Type: `str | None`
Passes selected color value as a hex `str` into the function.
Example Code
import gradio as gr
def predict(
value: str | None
):
... | Behavior | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
Parameters ▼
value: str | Callable | None
default `= None`
default color hex code to provide in color picker. If a function is provided,
the function will be called each time the app loads to set the initial value
of this component.
label: str | I18nData | None
default `= None`
the l... | Initialization | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
to top-level Components
in Blocks where fill_height=True.
min_width: int
default `= 160`
minimum pixel width, will wrap if not sufficient screen space to satisfy this
value. If a certain scale value results in this Component being narrower than
min_width, the min_width parameter will be respected fir... | Initialization | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
render()
function, if a component is re-rendered with the same key, these (and only
these) parameters will be preserved in the UI (if they have been changed by
the user or an event listener) instead of re-rendered based on the values
provided during constructor.
| Initialization | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
Shortcuts
gradio.ColorPicker
Interface String Shortcut `"colorpicker"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
color_picker
| Demos | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
Description
Event listeners allow you to respond to user interactions with the UI
components you've defined in a Gradio Blocks app. When a user interacts with
an element, such as changing a slider value or uploading an image, a function
is called.
Supported Event Listeners
The ColorPicker component supports the foll... | Event Listeners | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
ing to one output component.
inputs: Component | BlockContext | list[Component | BlockContext] | Set[Component | BlockContext] | None
default `= None`
List of gradio.components to use as inputs. If the function takes no inputs,
this should be an empty list.
outputs: Component | BlockCo... | Event Listeners | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
the progress animation on. If None,
will show the progress animation on all of the output components.
queue: bool
default `= True`
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, ... | Event Listeners | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
er_mode: Literal['once', 'multiple', 'always_last'] | None
default `= None`
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()`... | Event Listeners | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
atically be set to "private".
time_limit: int | None
default `= None`
stream_every: float
default `= 0.5`
key: int | str | tuple[int | str, ...] | None
default `= None`
A unique key for this event listener to be used in @gr.render(). If set, this
value identifies an e... | Event Listeners | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
Creates a button, that when clicked, allows a user to download a single
file of arbitrary type.
| Description | https://gradio.app/docs/gradio/downloadbutton | Gradio - Downloadbutton Docs |
**Using DownloadButton as an input component.**
How DownloadButton will pass its value to your function:
Type: `str | None`
(Rarely used) passes the file as a `str` into the function.
Example Code
import gradio as gr
def predict(
value: str | None
):
... | Behavior | https://gradio.app/docs/gradio/downloadbutton | Gradio - Downloadbutton Docs |
Parameters ▼
label: str
default `= "Download"`
Text to display on the button. Defaults to "Download".
value: str | Path | Callable | None
default `= None`
A str or pathlib.Path filepath or URL to download, or a Callable that returns
a str or pathlib.Path filepath or URL to download.
... | Initialization | https://gradio.app/docs/gradio/downloadbutton | Gradio - Downloadbutton Docs |
ents
in Blocks where fill_height=True.
min_width: int | None
default `= None`
minimum pixel width, will wrap if not sufficient screen space to satisfy this
value. If a certain scale value results in this Component being narrower than
min_width, the min_width parameter will be respected first.
... | Initialization | https://gradio.app/docs/gradio/downloadbutton | Gradio - Downloadbutton Docs |
Shortcuts
gradio.DownloadButton
Interface String Shortcut `"downloadbutton"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/downloadbutton | Gradio - Downloadbutton Docs |
upload_and_download
| Demos | https://gradio.app/docs/gradio/downloadbutton | Gradio - Downloadbutton Docs |
Description
Event listeners allow you to respond to user interactions with the UI
components you've defined in a Gradio Blocks app. When a user interacts with
an element, such as changing a slider value or uploading an image, a function
is called.
Supported Event Listeners
The DownloadButton component supports the f... | Event Listeners | https://gradio.app/docs/gradio/downloadbutton | Gradio - Downloadbutton Docs |
should be an empty list.
api_name: str | None
default `= None`
defines how the endpoint appears in the API docs. Can be a string or None. If
set to a string, the endpoint will be exposed in the API docs with the given
name. If None (default), the name of the function will be used as the API
endpoint.
... | Event Listeners | https://gradio.app/docs/gradio/downloadbutton | Gradio - Downloadbutton Docs |
t 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.
max_batch_siz... | Event Listeners | https://gradio.app/docs/gradio/downloadbutton | Gradio - Downloadbutton Docs |
ore 'fn', provided as either a function
or a raw code string. A function receives the values of 'inputs' and 'outputs'
as arguments; raw code can access them through `arguments`. Return a list of
values for the output components.
concurrency_limit: int | None | Literal['default']
default `= "default"`
... | Event Listeners | https://gradio.app/docs/gradio/downloadbutton | Gradio - Downloadbutton Docs |
on. If provided,
this function will be executed first with queue=False, and only if it
completes successfully will the main function be called. The validator
receives the same inputs as the main function, including the same keyword
arguments when `inputs_kwargs` is used, so its signature must accept those
keyword names... | Event Listeners | https://gradio.app/docs/gradio/downloadbutton | Gradio - Downloadbutton Docs |
Creates a file explorer component that allows users to browse files on the
machine hosting the Gradio app. As an input component, it also allows users to
select files to be used as input to a function, while as an output component,
it displays selected files.
| Description | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
**Using FileExplorer as an input component.**
How FileExplorer will pass its value to your function:
Type: `list[str] | str | None`
Passes the selected file or directory as a `str` path (relative to `root`) or
`list[str}` depending on `file_count`
Example Code
import gradio as gr
... | Behavior | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
Parameters ▼
glob: str
default `= "**/*"`
The glob-style pattern used to select which files to display, e.g. "*" to
match all files, "*.png" to match all .png files, "**/*.txt" to match any .txt
file in any subdirectory, etc. The default value matches all files and folders
recursively. See the Python ... | Initialization | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
onent. If None and
used in a `gr.Interface`, the label will be the name of the parameter this
component is assigned to.
every: Timer | float | None
default `= None`
Continuously calls `value` to recalculate it if `value` is a function (has no
effect otherwise). Can provide a Timer whose tick resets `v... | Initialization | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
min_height: int | str | None
default `= None`
interactive: bool | None
default `= None`
if True, will allow users to select file(s); if False, will only display
files. If not provided, this is inferred based on whether the component is
used as an input or output.
visi... | Initialization | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
buttons: list[Button] | None
default `= None`
A list of gr.Button() instances to show in the top right corner of the
component. Custom buttons will appear in the toolbar with their configured
icon and/or label, and clicking them will trigger any .click() events
registered on the button.
| Initialization | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
Shortcuts
gradio.FileExplorer
Interface String Shortcut `"fileexplorer"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
Description
Event listeners allow you to respond to user interactions with the UI
components you've defined in a Gradio Blocks app. When a user interacts with
an element, such as changing a slider value or uploading an image, a function
is called.
Supported Event Listeners
The FileExplorer component supports the fol... | Event Listeners | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
text] | None
default `= None`
List of gradio.components to use as inputs. If the function takes no inputs,
this should be an empty list.
outputs: Component | BlockContext | list[Component | BlockContext] | Set[Component | BlockContext] | None
default `= None`
List of gradio.components to use as outp... | Event Listeners | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
lt `= True`
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.
batch: bool
default `= False`
If True, then the function should process a... | Event Listeners | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
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.
js: str | Literal[True] | None
default `= ... | Event Listeners | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
5`
key: int | str | tuple[int | str, ...] | None
default `= None`
A unique key for this event listener to be used in @gr.render(). If set, this
value identifies an event as identical across re-renders when the key is
identical.
validator: Callable | None
default `= None`
Optional val... | Event Listeners | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
The Progress class provides a custom progress tracker that is used in a
function signature. To attach a Progress tracker to a function, simply add a
parameter right after the input parameters that has a default value set to a
`gradio.Progress()` instance. The Progress tracker can then be updated in the
function by call... | Description | https://gradio.app/docs/gradio/progress | Gradio - Progress Docs |
import gradio as gr
import time
def my_function(x, progress=gr.Progress()):
progress(0, desc="Starting...")
time.sleep(1)
for i in progress.tqdm(range(100)):
time.sleep(0.1)
return x
gr.Interface(my_function, gr.Textbox(), gr.Textbox()).queue().launch()
| Example Usage | https://gradio.app/docs/gradio/progress | Gradio - Progress Docs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.