text stringlengths 0 2k | heading1 stringlengths 3 79 | source_page_url stringclasses 188
values | source_page_title stringclasses 188
values |
|---|---|---|---|
Shortcuts
gradio.ImageEditor
Interface String Shortcut `"imageeditor"`
Initialization Uses default values
gradio.Sketchpad
Interface String Shortcut `"sketchpad"`
Initialization Uses sources=(), brush=Brush(colors=["000000"],
color_mode="fixed")
gradio.Paint
Interface S... | Shortcuts | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
image_editor
| Demos | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor 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 ImageEditor component supports the foll... | Event Listeners | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
function to call when this event is triggered. Often a machine learning
model's prediction function. Each parameter of the function corresponds to one
input component, and the function should return a single value or a tuple of
values, with each element in the tuple corresponding to one output component.
... | Event Listeners | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
nt area as well as a runtime display in
the upper right corner, "minimal" only shows the runtime display, "hidden"
shows no progress animation at all
show_progress_on: Component | list[Component] | None
default `= None`
Component or list of components to show the progress animation on. If None,
will s... | Event Listeners | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
ll cancel the click_event, where click_event
is the return value of another components .click method. Functions that have
not yet run (or generators that are iterating) will be cancelled, but
functions that are currently running will be allowed to finish.
trigger_mode: Literal['once', 'multiple', 'alway... | Event Listeners | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
en 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
default... | Event Listeners | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
Helper Classes | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs | |
gradio.Brush(···)
Description
A dataclass for specifying options for the brush tool in the ImageEditor
component. An instance of this class can be passed to the `brush` parameter of
`gr.ImageEditor`.
Initialization
Parameters ▼
default_size: int | Literal['auto']
default `= "auto"`
The default rad... | Brush | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
gradio.Eraser(···)
Description
A dataclass for specifying options for the eraser tool in the ImageEditor
component. An instance of this class can be passed to the `eraser` parameter
of `gr.ImageEditor`.
Initialization
Parameters ▼
default_size: int | Literal['auto']
default `= "auto"`
The default ... | Eraser | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
gradio.LayerOptions(···)
Description
A dataclass for specifying options for the layer tool in the ImageEditor
component. An instance of this class can be passed to the `layers` parameter
of `gr.ImageEditor`.
Initialization
Parameters ▼
allow_additional_layers: bool
default `= True`
If True, users ... | Layer Options | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
gradio.WebcamOptions(···)
Description
A dataclass for specifying options for the webcam tool in the ImageEditor
component. An instance of this class can be passed to the `webcam_options`
parameter of `gr.ImageEditor`.
Initialization
Parameters ▼
mirror: bool
default `= True`
If True, the webcam wi... | Webcam Options | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
Displays an interactive table of parameters and their descriptions and
default values with syntax highlighting. For each parameter, the user should
provide a type (e.g. a `str`), a human-readable description, and a default
value. As this component does not accept user input, it is rarely used as an
input component. Int... | Description | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
**Using ParamViewer as an input component.**
How ParamViewer will pass its value to your function:
Type: `dict[str, Parameter]`
(Rarely used) passes value as a `dict[str, dict]`. The key in the outer
dictionary is the parameter name, while the inner dictionary has keys "type",
"description", and "default" for each p... | Behavior | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
Parameters ▼
value: dict[str, Parameter] | None
default `= None`
A dictionary of dictionaries. The key in the outer dictionary is the parameter
name, while the inner dictionary has keys "type", "description", and "default"
for each parameter. Markdown links are supported in "description".
... | Initialization | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
er()
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.
header: str | None
default `= "Parameters"`
... | Initialization | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
Shortcuts
gradio.ParamViewer
Interface String Shortcut `"paramviewer"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer 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 ParamViewer component supports the foll... | Event Listeners | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
rns no
outputs, this 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 ... | Event Listeners | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
that it
should accept a list of input values for each parameter. The lists should be
of equal length (and be up to length `max_batch_size`). The function is then
*required* to return a tuple of lists (even if there is only 1 output
component), with each list in the tuple corresponding to one output component.
... | Event Listeners | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
js method to run before running 'fn'. Input arguments for js
method are values of 'inputs' and 'outputs', return should be a list of values
for output components.
concurrency_limit: int | None | Literal['default']
default `= "default"`
If set, this is the maximum number of this event that can be runni... | Event Listeners | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
lse, and only if it
completes successfully will the main function be called. The validator
receives the same inputs as the main function and should return a
`gr.validate()` for each input value.
[Documenting Custom Components](../../guides/documenting-custom-components/)
| Event Listeners | https://gradio.app/docs/gradio/paramviewer | Gradio - Paramviewer Docs |
Displays text that contains spans that are highlighted by category or
numerical value.
| Description | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
**Using HighlightedText as an input component.**
How HighlightedText will pass its value to your function:
Type: `list[tuple[str, str | float | None]] | None`
Passes the value as a list of tuples: `list[tuple]`. Each `tuple` consists of:
* a `str` substring of the text (so the entire text is included)
* a `str... | Behavior | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
Parameters ▼
value: list[tuple[str, str | float | None]] | dict | Callable | None
default `= None`
Default value to show. If a function is provided, the function will be called
each time the app loads to set the initial value of this component.
color_map: dict[str, str] | None
default... | Initialization | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
inputs: Component | list[Component] | 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... | Initialization | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
e 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 across re-renders are treated as
the same component, not a new component. Properties set in 'preserved_by_key'
are no... | Initialization | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
Shortcuts
gradio.HighlightedText
Interface String Shortcut `"highlightedtext"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
diff_texts
| Demos | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext 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 HighlightedText component supports the ... | Event Listeners | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
puts,
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 outputs. If the function returns no
outputs, this should be an empty list.
api_name: str | ... | Event Listeners | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
l 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 batch of inputs, meaning that it
should accept a list of input values for each parameter. The lists sh... | Event Listeners | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
llowed 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 `= None`
Optional frontend js method to run before running 'fn'. Input arguments for js
method are values... | Event Listeners | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
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 function be called. T... | Event Listeners | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
Sidebar is a collapsible panel that renders child components on the left
side of the screen within a Blocks layout.
| Description | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
with gr.Blocks() as demo:
with gr.Sidebar():
gr.Textbox()
gr.Button()
| Example Usage | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
Parameters ▼
label: str | I18nData | None
default `= None`
name of the sidebar. Not displayed to the user.
open: bool
default `= True`
if True, sidebar is open by default.
visible: bool | Literal['hidden']
default `= True`
elem_id: str | None
default... | Initialization | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
Methods | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs | |
%20Copyright%202022%20Fonticons,%20Inc.... | expand | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar 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%20... | expand | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
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[Component | BlockContext] | None
default `= None`
List of gradio.co... | expand | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
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.
queue: bool
default `= True`
If True, will place the request on t... | expand | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
ators 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 while an event is pend... | expand | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
oad). 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 listener to be used in @g... | expand | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | collapse | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar 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%... | collapse | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
nds 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[Component | BlockContext] | None
default `= None`
List of gradio... | collapse | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
on 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.
queue: bool
default `= True`
If True, will place the request o... | collapse | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
nerators 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 while an event is p... | collapse | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
r.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 listener to be used in... | collapse | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | expand | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar 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%20... | expand | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
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[Component | BlockContext] | None
default `= None`
List of gradio.co... | expand | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
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.
queue: bool
default `= True`
If True, will place the request on t... | expand | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
ators 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 while an event is pend... | expand | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
oad). 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 listener to be used in @g... | expand | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | collapse | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar 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%... | collapse | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
nds 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[Component | BlockContext] | None
default `= None`
List of gradio... | collapse | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
on 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.
queue: bool
default `= True`
If True, will place the request o... | collapse | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
nerators 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 while an event is p... | collapse | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
r.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 listener to be used in... | collapse | https://gradio.app/docs/gradio/sidebar | Gradio - Sidebar Docs |
Thread-safe cache with manual get/set control, injected as a function
parameter (add as a default parameter value and Gradio will inject it
automatically). Supports per-session isolation so cached data doesn't leak
between users, content-aware hashing for ML types (numpy, PIL, pandas), and
LRU eviction with memory limi... | Description | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
import gradio as gr
def generate(prompt, c=gr.Cache(per_session=True)):
hit = c.get(prompt)
if hit is not None:
return hit["result"]
result = llm(prompt)
c.set(prompt, result=result)
return result
| Example Usage | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
Parameters ▼
max_size: int
default `= 128`
max_memory: str | int | None
default `= None`
per_session: bool
default `= False`
| Initialization | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
Methods | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs | |
%20Copyright%202022%20Fonticons,%20Inc.... | get | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class 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%20... | get | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | set | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class 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%2039... | set | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | keys | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class 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%20318.... | keys | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | clear | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class 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%20318... | clear | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | get | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class 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%20... | get | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | set | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class 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%2039... | set | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | keys | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class 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%20318.... | keys | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | clear | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class 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%20318... | clear | https://gradio.app/docs/gradio/cache-class | Gradio - Cache Class Docs |
The gr.DownloadData class is a subclass of gr.EventData that specifically
carries information about the `.download()` event. When gr.DownloadData is
added as a type hint to an argument of an event listener method, a
gr.DownloadData object will automatically be passed as the value of that
argument. The attributes of thi... | Description | https://gradio.app/docs/gradio/downloaddata | Gradio - Downloaddata Docs |
import gradio as gr
def on_download(download_data: gr.DownloadData):
return f"Downloaded file: {download_data.file.path}"
with gr.Blocks() as demo:
files = gr.File()
textbox = gr.Textbox()
files.download(on_download, None, textbox)
demo.launch()
| Example Usage | https://gradio.app/docs/gradio/downloaddata | Gradio - Downloaddata Docs |
Parameters ▼
file: FileData
The file that was downloaded, as a FileData object.
| Attributes | https://gradio.app/docs/gradio/downloaddata | Gradio - Downloaddata Docs |
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).
Demo: zip_files, zip_to_json
| Description | https://gradio.app/docs/gradio/file | Gradio - File Docs |
**Using File as an input component.**
How File will pass its value to your function:
Type: `bytes | str | list[bytes] | list[str] | None`
Passes the file as a `str` or `bytes` object, or a list of `str` or list of
`bytes` objects, depending on `type` and `file_count`.
Example Code
import... | Behavior | https://gradio.app/docs/gradio/file | Gradio - File Docs |
Parameters ▼
value: str | list[str] | Callable | None
default `= None`
Default file(s) to display, given as a str file path or URL, or a list of str
file paths / URLs. 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/file | Gradio - File Docs |
r whose tick resets `value`, or a float
that provides the regular interval for the reset Timer.
inputs: Component | list[Component] | 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 recalculat... | Initialization | https://gradio.app/docs/gradio/file | Gradio - File Docs |
visible: bool | Literal['hidden']
default `= True`
If False, component will be hidden. If "hidden", component will be visually
hidden and not take up space in the layout but still exist in the DOM
elem_id: str | None
default `= None`
An optional string that is assigned as the id of this c... | Initialization | https://gradio.app/docs/gradio/file | Gradio - File Docs |
Shortcuts
gradio.File
Interface String Shortcut `"file"`
Initialization Uses default values
gradio.Files
Interface String Shortcut `"files"`
Initialization Uses file_count="multiple"
| Shortcuts | https://gradio.app/docs/gradio/file | Gradio - File 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 File component supports the following e... | Event Listeners | https://gradio.app/docs/gradio/file | Gradio - File Docs |
ded file
as a FileData object. See EventData documentation on how to use this event
data
Event Parameters
Parameters ▼
fn: Callable | None | Literal['decorator']
default `= "decorator"`
the function to call when this event is triggered. Often a machine learning
model's prediction function. Each para... | Event Listeners | https://gradio.app/docs/gradio/file | Gradio - File Docs |
n completion
show_progress: Literal['full', 'minimal', 'hidden']
default `= "full"`
how to show the progress animation while event is running: "full" shows a
spinner which covers the output component area as well as a runtime display in
the upper right corner, "minimal" only shows the runtime display,... | Event Listeners | https://gradio.app/docs/gradio/file | Gradio - File Docs |
o the browser.
cancels: dict[str, Any] | list[dict[str, Any]] | None
default `= None`
A list of other events to cancel when this listener is triggered. For example,
setting cancels=[click_event] will cancel the click_event, where click_event
is the return value of another components .click method. Fun... | Event Listeners | https://gradio.app/docs/gradio/file | Gradio - File Docs |
isibility: Literal['public', 'private', 'undocumented']
default `= "public"`
controls the visibility and accessibility of this endpoint. Can be "public"
(shown in API docs and callable by clients), "private" (hidden from API docs
and not callable by the Gradio client libraries), or "undocumented" (hidden
from API doc... | Event Listeners | https://gradio.app/docs/gradio/file | Gradio - File Docs |
Creates a scatter plot component to display data from a pandas DataFrame.
| Description | https://gradio.app/docs/gradio/scatterplot | Gradio - Scatterplot Docs |
**Using ScatterPlot as an input component.**
How ScatterPlot will pass its value to your function:
Type: `PlotData | None`
The data to display in a line plot.
Example Code
import gradio as gr
def predict(
value: PlotData | None
):
process valu... | Behavior | https://gradio.app/docs/gradio/scatterplot | Gradio - Scatterplot Docs |
Parameters ▼
value: pd.DataFrame | Callable | None
default `= None`
The pandas dataframe containing the data to display in the plot.
x: str | None
default `= None`
Column corresponding to the x axis. Column can be numeric, datetime, or
string/category.
y: str | None
... | Initialization | https://gradio.app/docs/gradio/scatterplot | Gradio - Scatterplot Docs |
ne`
List containing column names of the series to show in the legend. By default,
all series are shown.
x_lim: list[float | None] | None
default `= None`
A tuple or list containing the limits for the x-axis, specified as [x_min,
x_max]. To fix only one of these values, set the other to None, e.g. [0,... | Initialization | https://gradio.app/docs/gradio/scatterplot | Gradio - Scatterplot Docs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.