text stringlengths 0 2k | heading1 stringlengths 3 79 | source_page_url stringclasses 188
values | source_page_title stringclasses 188
values |
|---|---|---|---|
e
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 `.change()`) would not allow any
submissions... | Event Listeners | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
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
default `= 0.5`
key: int | str | tuple[int | str, ...] | None
default `= None`
A unique key for this event li... | Event Listeners | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
Creates a gallery or table to display data samples. This component is
primarily designed for internal use to display examples. However, it can also
be used directly to display a dataset and let users select examples.
| Description | https://gradio.app/docs/gradio/dataset | Gradio - Dataset Docs |
**Using Dataset as an input component.**
How Dataset will pass its value to your function:
Type: `int | list | tuple[int, list] | None`
Passes the selected sample either as a `list` of data corresponding to each
input component (if `type` is "value") or as an `int` index (if `type` is
"index"), or as a `tuple` of th... | Behavior | https://gradio.app/docs/gradio/dataset | Gradio - Dataset Docs |
Parameters ▼
label: str | I18nData | None
default `= None`
the label for this component, appears above the component.
show_label: bool
default `= True`
If True, the label will be shown above the component.
components: list[Component] | list[str] | None
default `= Non... | Initialization | https://gradio.app/docs/gradio/dataset | Gradio - Dataset Docs |
re more
than one component, the layout can only be "table".
samples_per_page: int
default `= 10`
how many examples to show per page.
visible: bool | Literal['hidden']
default `= True`
If False, component will be hidden. If "hidden", component will be visually
hidden and not take up s... | Initialization | https://gradio.app/docs/gradio/dataset | Gradio - Dataset Docs |
scale: int | None
default `= None`
relative size compared to adjacent Components. For example 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.
... | Initialization | https://gradio.app/docs/gradio/dataset | Gradio - Dataset Docs |
Shortcuts
gradio.Dataset
Interface String Shortcut `"dataset"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/dataset | Gradio - Dataset Docs |
**Updating a Dataset**
In this example, we display a text dataset using `gr.Dataset` and then update
it when the user clicks a button:
import gradio as gr
philosophy_quotes = [
["I think therefore I am."],
["The unexamined life is not worth living."]
]
startup_quote... | Examples | https://gradio.app/docs/gradio/dataset | Gradio - Dataset 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 Dataset component supports the followin... | Event Listeners | https://gradio.app/docs/gradio/dataset | Gradio - Dataset Docs |
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.
api_description: st... | Event Listeners | https://gradio.app/docs/gradio/dataset | Gradio - Dataset Docs |
arameter. 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_size: int
default `= 4`
Maximum numb... | Event Listeners | https://gradio.app/docs/gradio/dataset | Gradio - Dataset Docs |
r js
method are values of 'inputs' and 'outputs', return should be a list of values
for output components.
concurrency_limit: int | None | Literal['default']
default `= "default"`
If set, this is the maximum number of this event that can be running
simultaneously. Can be set to None to mean no concurr... | Event Listeners | https://gradio.app/docs/gradio/dataset | Gradio - Dataset Docs |
function be called. The validator
receives the same inputs as the main function and should return a
`gr.validate()` for each input value.
| Event Listeners | https://gradio.app/docs/gradio/dataset | Gradio - Dataset Docs |
A Gradio Interface includes a ‘Flag’ button that appears underneath the
output. By default, clicking on the Flag button sends the input and output
data back to the machine where the gradio demo is running, and saves it to a
CSV log file. But this default behavior can be changed. To set what happens
when the Flag button... | Description | https://gradio.app/docs/gradio/flagging | Gradio - Flagging Docs |
A simplified implementation of the FlaggingCallback abstract class provided
for illustrative purposes. Each flagged sample (both the input and output
data) is logged to a CSV file on the machine running the gradio app.
| Description | https://gradio.app/docs/gradio/flagging | Gradio - Flagging Docs |
import gradio as gr
def image_classifier(inp):
return {'cat': 0.3, 'dog': 0.7}
demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label",
flagging_callback=SimpleCSVLogger())
CSVLogger
gradio.CSVLogger(···)
| Example Usage | https://gradio.app/docs/gradio/flagging | Gradio - Flagging Docs |
The default implementation of the FlaggingCallback abstract class in
gradio>=5.0. Each flagged sample (both the input and output data) is logged to
a CSV file with headers on the machine running the gradio app. Unlike
ClassicCSVLogger, this implementation is concurrent-safe and it creates a new
dataset file every time ... | Description | https://gradio.app/docs/gradio/flagging | Gradio - Flagging Docs |
import gradio as gr
def image_classifier(inp):
return {'cat': 0.3, 'dog': 0.7}
demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label",
flagging_callback=CSVLogger())
| Example Usage | https://gradio.app/docs/gradio/flagging | Gradio - Flagging Docs |
Parameters ▼
simplify_file_data: bool
default `= True`
If True, the file data will be simplified before being written to the CSV
file. If CSVLogger is being used to cache examples, this is set to False to
preserve the original FileData class
verbose: bool
default `= True`
If True, pr... | Initialization | https://gradio.app/docs/gradio/flagging | Gradio - Flagging Docs |
Used to display arbitrary JSON output prettily. As this component does not
accept user input, it is rarely used as an input component.
| Description | https://gradio.app/docs/gradio/json | Gradio - Json Docs |
**Using JSON as an input component.**
How JSON will pass its value to your function:
Type: `dict | list | None`
Passes the JSON value as a `dict` or `list` depending on the value.
Example Code
import gradio as gr
def predict(
value: dict | list | None
):
... | Behavior | https://gradio.app/docs/gradio/json | Gradio - Json Docs |
Parameters ▼
value: str | dict | list | Callable | None
default `= None`
Default value as a valid JSON `str` -- or a `list` or `dict` that can be
serialized to a JSON string. If a function is provided, the function will be
called each time the app loads to set the initial value of this component.
... | Initialization | https://gradio.app/docs/gradio/json | Gradio - Json Docs |
rap 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.
visible: bool | Literal['hidden']
default `= True`
If False, component will be hidden. If "hidden", component wil... | Initialization | https://gradio.app/docs/gradio/json | Gradio - Json Docs |
levels deeper than 3 are collapsed.
show_indices: bool
default `= False`
Whether to show numerical indices when displaying the elements of a list
within the JSON object.
height: int | str | None
default `= None`
Height of the JSON component in pixels if a number is passed, or in CSS... | Initialization | https://gradio.app/docs/gradio/json | Gradio - Json Docs |
Shortcuts
gradio.JSON
Interface String Shortcut `"json"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/json | Gradio - Json Docs |
zip_to_jsonblocks_xray
| Demos | https://gradio.app/docs/gradio/json | Gradio - Json 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 JSON component supports the following e... | Event Listeners | https://gradio.app/docs/gradio/json | Gradio - Json Docs |
PI 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.
api_description: str | None | Literal[False]
default `= None`
Description of the API endpoint. Can be a ... | Event Listeners | https://gradio.app/docs/gradio/json | Gradio - Json Docs |
he 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_size: int
default `= 4`
Maximum number of inputs to batch together if this is called from the queue
(only relevant if batch... | Event Listeners | https://gradio.app/docs/gradio/json | Gradio - Json Docs |
output components.
concurrency_limit: int | None | Literal['default']
default `= "default"`
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" t... | Event Listeners | https://gradio.app/docs/gradio/json | Gradio - Json Docs |
ould return a
`gr.validate()` for each input value.
| Event Listeners | https://gradio.app/docs/gradio/json | Gradio - Json 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 spac... | Initialization | https://gradio.app/docs/gradio/label | Gradio - Label Docs |
meters 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 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 outp... | Event Listeners | https://gradio.app/docs/gradio/label | Gradio - Label Docs |
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 function be called. The validator
receives the same inputs as the main function and should ... | Event Listeners | https://gradio.app/docs/gradio/label | Gradio - Label Docs |
A base class for defining methods that all input/output components should
have.
| Description | https://gradio.app/docs/gradio/state | Gradio - State Docs |
**Using State as an input component.**
How State will pass its value to your function:
Type: `Any`
Passes a value of arbitrary type through.
Example Code
import gradio as gr
def predict(
value: Any
):
process value from the State component
... | Behavior | https://gradio.app/docs/gradio/state | Gradio - State Docs |
Parameters ▼
value: Any
default `= None`
the initial value (of arbitrary type) of the state. The provided argument is
deepcopied. If a callable is provided, the function will be called whenever
the app loads to set the initial value of the state.
render: bool
default `= True`
should ... | Initialization | https://gradio.app/docs/gradio/state | Gradio - State 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 State component supports the following ... | Event Listeners | https://gradio.app/docs/gradio/state | Gradio - State Docs |
e 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.
api_description: str | None | Literal[False]
default `= None`
Description of the API endpoint. Can be... | Event Listeners | https://gradio.app/docs/gradio/state | Gradio - State Docs |
. 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_size: int
default `= 4`
Maximum number of inputs to batch together if this is called from the queue
(only relevant if ba... | Event Listeners | https://gradio.app/docs/gradio/state | Gradio - State Docs |
for output components.
concurrency_limit: int | None | Literal['default']
default `= "default"`
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... | Event Listeners | https://gradio.app/docs/gradio/state | Gradio - State Docs |
should return a
`gr.validate()` for each input value.
| Event Listeners | https://gradio.app/docs/gradio/state | Gradio - State 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 |
nts
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 |
api_description: str | None | Literal[False]
default `= None`
Description of the API endpoint. Can be a string, None, or False. If set to a
string, the endpoint will be exposed in the API docs with the given
description. If None, the function's docstring will be used as the API
endpoint description. If False, then ... | Event Listeners | https://gradio.app/docs/gradio/downloadbutton | Gradio - Downloadbutton Docs |
t `= 4`
Maximum number of inputs to batch together if this is called from the queue
(only relevant if batch=True)
preprocess: bool
default `= True`
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`
... | Event Listeners | https://gradio.app/docs/gradio/downloadbutton | Gradio - Downloadbutton Docs |
ne 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).
concurrency_id: str | None
default `= None`
If set, ... | Event Listeners | https://gradio.app/docs/gradio/downloadbutton | Gradio - Downloadbutton Docs |
Creates an audio component that can be used to upload/record audio (as an
input) or display audio (as an output).
| Description | https://gradio.app/docs/gradio/audio | Gradio - Audio Docs |
**Using Audio as an input component.**
How Audio will pass its value to your function:
Type: `str | tuple[int, np.ndarray] | None`
Passes audio as one of these formats (depending on `type`):
* `str` filepath
* `tuple` of (sample rate in Hz, audio data as numpy array).
* The audio data is a 16-bit `int` ar... | Behavior | https://gradio.app/docs/gradio/audio | Gradio - Audio Docs |
Parameters ▼
value: str | Path | tuple[int, np.ndarray] | Callable | None
default `= None`
A path, URL, or [sample_rate, numpy array] tuple (sample rate in Hz, audio
data as a float or int numpy array) for the default value that Audio component
is going to take. If a function is provided, the function... | Initialization | https://gradio.app/docs/gradio/audio | Gradio - Audio Docs |
set[Component] | None
default `= None`
Components that are used as inputs to calculate `value` if `value` is a
function (has no effect otherwise). `value` is recalculated any time the
inputs change.
show_label: bool | None
default `= None`
if True, will display label.
container: bool... | Initialization | https://gradio.app/docs/gradio/audio | Gradio - Audio Docs |
elem_id: str | None
default `= None`
An optional string that is assigned as the id of this component in the HTML
DOM. Can be used for targeting CSS styles.
elem_classes: list[str] | str | None
default `= None`
An optional list of strings that are assigned as the classes of this component
in ... | Initialization | https://gradio.app/docs/gradio/audio | Gradio - Audio Docs |
and the audio is kept as is. In the case where output audio is
returned from the prediction function as numpy array and no `format` is
provided, it will be returned as a "wav" file.
autoplay: bool
default `= False`
Whether to automatically play the audio when the component is used as an
output. Note: ... | Initialization | https://gradio.app/docs/gradio/audio | Gradio - Audio Docs |
hone
if the source is set to "microphone". Defaults to False.
subtitles: str | Path | list[dict[str, Any]] | None
default `= None`
A subtitle file (srt, vtt, or json) for the audio, or a list of subtitle
dictionaries in the format [{"text": str, "timestamp": [start, end]}] where
timestamps are in seco... | Initialization | https://gradio.app/docs/gradio/audio | Gradio - Audio Docs |
Shortcuts
gradio.Audio
Interface String Shortcut `"audio"`
Initialization Uses default values
gradio.Microphone
Interface String Shortcut `"microphone"`
Initialization Uses sources=["microphone"]
| Shortcuts | https://gradio.app/docs/gradio/audio | Gradio - Audio Docs |
generate_tonereverse_audio
| Demos | https://gradio.app/docs/gradio/audio | Gradio - Audio 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 Audio component supports the following ... | Event Listeners | https://gradio.app/docs/gradio/audio | Gradio - Audio Docs |
r stops recording with the Audio.
Audio.upload(fn, ···)
This listener is triggered when the user uploads a file into the Audio.
Audio.input(fn, ···)
This listener is triggered when the user changes the value of the Audio.
Event Parameters
Parameters ▼
fn: Callable | Non... | Event Listeners | https://gradio.app/docs/gradio/audio | Gradio - Audio Docs |
f False, then no description will be displayed in the
API docs.
scroll_to_output: bool
default `= False`
If True, will scroll to output component on completion
show_progress: Literal['full', 'minimal', 'hidden']
default `= "minimal"`
how to show the progress animation while event is ... | Event Listeners | https://gradio.app/docs/gradio/audio | Gradio - Audio Docs |
with the `Image`
component).
postprocess: bool
default `= True`
If False, will not run postprocessing of component data before returning 'fn'
output to the browser.
cancels: dict[str, Any] | list[dict[str, Any]] | None
default `= None`
A list of other events to cancel when this liste... | Event Listeners | https://gradio.app/docs/gradio/audio | Gradio - Audio Docs |
= None`
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.
api_visibility: Literal['public', 'private', 'undocumented']
default `= "public"`
controls the visibility and accessibility of this endpoint. Can be "publi... | Event Listeners | https://gradio.app/docs/gradio/audio | Gradio - Audio Docs |
Helper Classes | https://gradio.app/docs/gradio/audio | Gradio - Audio Docs | |
gradio.WaveformOptions(···)
Description
A dataclass for specifying options for the waveform display in the Audio
component. An instance of this class can be passed into the `waveform_options`
parameter of `gr.Audio`.
Initialization
Parameters ▼
waveform_color: str | None
default `= None`
The color... | WaveformOptions | https://gradio.app/docs/gradio/audio | Gradio - Audio Docs |
Validates that the audio length is within the specified min and max length (in
seconds). You can use this to construct a validator that will check if the
user-provided audio is either too short or too long.
import gradio as gr
demo = gr.Interface(
lambda x: x,
inputs="audio",
... | is_audio_correct_length | https://gradio.app/docs/gradio/audio | Gradio - Audio Docs |
Load a chat interface from an OpenAI API chat compatible endpoint.
| Description | https://gradio.app/docs/gradio/load_chat | Gradio - Load_Chat Docs |
import gradio as gr
demo = gr.load_chat("http://localhost:11434/v1", model="deepseek-r1")
demo.launch()
| Example Usage | https://gradio.app/docs/gradio/load_chat | Gradio - Load_Chat Docs |
Parameters ▼
base_url: str
The base URL of the endpoint, e.g. "http://localhost:11434/v1/"
model: str
The name of the model you are loading, e.g. "llama3.2"
token: str | None
default `= None`
The API token or a placeholder string if you are using a local model, e.g.
"... | Initialization | https://gradio.app/docs/gradio/load_chat | Gradio - Load_Chat 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`
Continously calls `value` to recalculate it if `value` is a function (has no
effect otherwise). Can provide a Timer whose tick resets `va... | 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.
visib... | 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 |
ique 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 validation function to run before the main function. If provided,
this function will be exe... | Event Listeners | https://gradio.app/docs/gradio/fileexplorer | Gradio - Fileexplorer Docs |
Creates an image component that, as an input, can be used to upload and
edit images using simple editing tools such as brushes, strokes, cropping, and
layers. Or, as an output, this component can be used to display images.
| Description | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
**Using ImageEditor as an input component.**
How ImageEditor will pass its value to your function:
Type: `EditorValue | None`
Passes the uploaded images as an instance of EditorValue, which is just a
`dict` with keys: 'background', 'layers', and 'composite'.
* The values corresponding to 'background' and 'composi... | Behavior | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
Parameters ▼
value: EditorValue | ImageType | None
default `= None`
Optional initial image(s) to populate the image editor. Should be a dictionary
with keys: `background`, `layers`, and `composite`. The values corresponding
to `background` and `composite` should be images or None, while `layers`
shoul... | Initialization | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
webcam', 'clipboard'] | None
default `= ('upload', 'webcam', 'clipboard')`
List of sources that can be used to set the background image. "upload" creates
a box where user can drop an image file, "webcam" allows user to take snapshot
from their webcam, "clipboard" allows users to paste an image from the
clipboard.
... | Initialization | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
nt. Valid options are
"download" to download the image, "share" to share to Hugging Face Spaces
Discussions, and "fullscreen" to view in fullscreen mode. By default, all
buttons are shown.
container: bool
default `= True`
If True, will place the component in a container - providing some extra
padding ... | Initialization | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
r: bool
default `= True`
If False, component will not render be rendered in the Blocks context. Should
be used if the intention is to assign event listeners now but render the
component later.
key: int | str | tuple[int | str, ...] | None
default `= None`
in a gr.render, Components with the same key... | Initialization | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
also hide the eraser tool. See `gr.Brush`
docs.
format: str
default `= "webp"`
Format to save image if it does not already have a valid format (e.g. if the
image is being returned to the frontend as a numpy array or PIL Image). The
format should be supported by the PIL library. This parameter has no e... | Initialization | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.