text stringlengths 0 2k | heading1 stringlengths 3 79 | source_page_url stringclasses 189
values | source_page_title stringclasses 189
values |
|---|---|---|---|
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 plot component to display various kinds of plots (matplotlib,
plotly, altair, or bokeh plots are supported). As this component does not
accept user input, it is rarely used as an input component.
| Description | https://gradio.app/docs/gradio/plot | Gradio - Plot Docs |
**Using Plot as an input component.**
How Plot will pass its value to your function:
Type: `PlotData | None`
(Rarely used) passes the data displayed in the plot as an PlotData dataclass,
which includes the plot information as a JSON string, as well as the type of
chart and the plotting library.
Example Code
... | Behavior | https://gradio.app/docs/gradio/plot | Gradio - Plot Docs |
Parameters ▼
value: Any | None
default `= None`
Optionally, supply a default plot object to display, must be a matplotlib,
plotly, altair, or bokeh figure, or a callable. 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/plot | Gradio - Plot 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 firs... | Initialization | https://gradio.app/docs/gradio/plot | Gradio - Plot Docs |
g constructor.
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/plot | Gradio - Plot Docs |
Shortcuts
gradio.Plot
Interface String Shortcut `"plot"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/plot | Gradio - Plot Docs |
blocks_kinematicsstock_forecast
| Demos | https://gradio.app/docs/gradio/plot | Gradio - Plot 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 Plot component supports the following e... | Event Listeners | https://gradio.app/docs/gradio/plot | Gradio - Plot 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/plot | Gradio - Plot 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/plot | Gradio - Plot 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/plot | Gradio - Plot Docs |
ould return a
`gr.validate()` for each input value.
[Plot Component For Maps](../../guides/plot-component-for-maps/)
| Event Listeners | https://gradio.app/docs/gradio/plot | Gradio - Plot Docs |
Row is a layout element within Blocks that renders all children
horizontally.
| Description | https://gradio.app/docs/gradio/row | Gradio - Row Docs |
with gr.Blocks() as demo:
with gr.Row():
gr.Image("lion.jpg", scale=2)
gr.Image("tiger.jpg", scale=1)
demo.launch()
| Example Usage | https://gradio.app/docs/gradio/row | Gradio - Row Docs |
Parameters ▼
variant: Literal['default', 'panel', 'compact']
default `= "default"`
row type, 'default' (no background), 'panel' (gray background color and
rounded corners), or 'compact' (rounded corners and no internal gap).
visible: bool | Literal['hidden']
default `= True`
If False... | Initialization | https://gradio.app/docs/gradio/row | Gradio - Row Docs |
is
smaller than `max_height`.
min_height: int | str | None
default `= None`
The minimum height of the row, specified in pixels if a number is passed, or
in CSS units if a string is passed. If content exceeds the height, the row
will expand to fit the content. Will not have any effect if `height` is s... | Initialization | https://gradio.app/docs/gradio/row | Gradio - Row Docs |
The widths of elements in a `Row` can be controlled via a combination of
`scale` and `min_width` arguments that are present in every component.
* `scale` is an integer that defines how an element will take up space in a `Row`. If `scale` is set to 0, the element will not expand to take up space. If `scale` is set to... | Controlling Width | https://gradio.app/docs/gradio/row | Gradio - Row 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 |
der()
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 |
Creates a button that can be assigned arbitrary .click() events. The value
(label) of the button can be used as an input to the function (rarely used) or
set via the output of a function.
| Description | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
**Using Button as an input component.**
How Button will pass its value to your function:
Type: `str | None`
(Rarely used) the `str` corresponding to the button label when the button is
clicked
Example Code
import gradio as gr
def predict(
value: str | None
... | Behavior | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
Parameters ▼
value: str | I18nData | Callable
default `= "Run"`
default text for the button to display. If a function is provided, the
function will be called each time the app loads to set the initial value of
this component.
every: Timer | float | None
default `= None`
continuously... | Initialization | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
iteral['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
interactive: bool
default `= True`
if False, the Button will be in a disabled state.
elem_id: str | None... | Initialization | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
scale applies in Rows, and to top-level Components
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_wid... | Initialization | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
Shortcuts
gradio.Button
Interface String Shortcut `"button"`
Initialization Uses default values
gradio.ClearButton
Interface String Shortcut `"clearbutton"`
Initialization Uses default values
gradio.DeepLinkButton
Interface String Shortcut `"deeplinkbutton"`
Initializa... | Shortcuts | https://gradio.app/docs/gradio/button | Gradio - Button 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 Button component supports the following... | Event Listeners | https://gradio.app/docs/gradio/button | Gradio - Button 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: str | N... | Event Listeners | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
ter. 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 number of... | Event Listeners | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
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 concurrency_... | Event Listeners | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
tion 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/button | Gradio - Button Docs |
Used to render arbitrary Markdown output. Can also render latex enclosed by
dollar signs as well as code blocks with syntax highlighting. Supported
languages are bash, c, cpp, go, java, javascript, json, php, python, rust,
sql, and yaml. As this component does not accept user input, it is rarely used
as an input compon... | Description | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
**Using Markdown as an input component.**
How Markdown will pass its value to your function:
Type: `str | None`
Passes the `str` of Markdown corresponding to the displayed value.
Example Code
import gradio as gr
def predict(
value: str | None
):
... | Behavior | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
Parameters ▼
value: str | I18nData | Callable | None
default `= None`
Value to show in Markdown component. 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`
This par... | Initialization | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
None`
A list of dicts of the form {"left": open delimiter (str), "right": close
delimiter (str), "display": whether to display in newline (bool)} that will be
used to render LaTeX expressions. If not provided, `latex_delimiters` is set
to `[{ "left": "$$", "right": "$$", "display": True }]`, so only expressions
enclo... | Initialization | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
endered 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.
sanitize_html: bool
default `= True`
If False, will disable HTML sanitization wh... | Initialization | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
] | None
default `= None`
A list of buttons to show for the component. Currently, the only valid option
is "copy". The "copy" button allows the user to copy the text in the Markdown
component. By default, no buttons are shown.
container: bool
default `= False`
If True, the Markdown component will be... | Initialization | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
Shortcuts
gradio.Markdown
Interface String Shortcut `"markdown"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
blocks_helloblocks_kinematics
| Demos | https://gradio.app/docs/gradio/markdown | Gradio - Markdown 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 Markdown component supports the followi... | Event Listeners | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
et[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 docs. Can be a string or None. If
set to a string, the... | Event Listeners | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
pp.
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 function is then
*required* to return a tuple of lists... | Event Listeners | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
fter 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 output components.
concurrency_limit: in... | Event Listeners | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
nal 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 return a
`gr.validate()` for each input value.
| Event Listeners | https://gradio.app/docs/gradio/markdown | Gradio - Markdown 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 |
ent. 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 |
er: 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 ke... | 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 ... | Initialization | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
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 |
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 |
er 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 recalcula... | 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 ... | 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 line plot component to display data from a pandas DataFrame.
| Description | https://gradio.app/docs/gradio/lineplot | Gradio - Lineplot Docs |
**Using LinePlot as an input component.**
How LinePlot 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 value from... | Behavior | https://gradio.app/docs/gradio/lineplot | Gradio - Lineplot 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/lineplot | Gradio - Lineplot 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/lineplot | Gradio - Lineplot Docs |
", "-x", "-y", or list of strings that represent the order of the
categories.
tooltip: Literal['axis', 'none', 'all'] | list[str]
default `= "axis"`
The tooltip to display when hovering on a point. "axis" shows the values for
the axis columns, "all" shows all column values, and "none" shows no tooltip... | Initialization | https://gradio.app/docs/gradio/lineplot | Gradio - Lineplot Docs |
uts: 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.
visible: bool | Literal['hidden']
default `= True`
Whether the plo... | Initialization | https://gradio.app/docs/gradio/lineplot | Gradio - Lineplot Docs |
-render.
preserved_by_key: list[str] | str | None
default `= "value"`
A list of parameters from this component's constructor. Inside a gr.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 ... | Initialization | https://gradio.app/docs/gradio/lineplot | Gradio - Lineplot Docs |
`gr.LinePlot`, `gr.ScatterPlot`, and `gr.BarPlot` all share the same API. Here
is a summary of the most important features. For full details and live demos,
see the [Creating Plots](/guides/creating-plots) and [Time
Plots](/guides/time-plots) guides.
**Basic Usage with a DataFrame**
Pass a `pd.DataFrame` as the value... | Key Concepts | https://gradio.app/docs/gradio/lineplot | Gradio - Lineplot Docs |
ex[0], selection.index[1]])
plot.double_click(lambda: gr.LinePlot(x_lim=None), outputs=plot)
**Realtime Data**
Use `gr.Timer` to keep plots updated with live data. You can attach the timer
via `every`, or wire it up manually:
def get_data():
return pd.DataFrame(...) fetch latest d... | Key Concepts | https://gradio.app/docs/gradio/lineplot | Gradio - Lineplot Docs |
Shortcuts
gradio.LinePlot
Interface String Shortcut `"lineplot"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/lineplot | Gradio - Lineplot Docs |
line_plot_demo
| Demos | https://gradio.app/docs/gradio/lineplot | Gradio - Lineplot 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 LinePlot component supports the followi... | Event Listeners | https://gradio.app/docs/gradio/lineplot | Gradio - Lineplot Docs |
omponents 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 outputs. If the function returns no
outputs, this sh... | Event Listeners | https://gradio.app/docs/gradio/lineplot | Gradio - Lineplot Docs |
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 batch of inputs, meaning that it
should accept ... | Event Listeners | https://gradio.app/docs/gradio/lineplot | Gradio - Lineplot Docs |
ding. 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 `= None`
Optional frontend js method to run before... | Event Listeners | https://gradio.app/docs/gradio/lineplot | Gradio - Lineplot Docs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.