text stringlengths 0 2k | heading1 stringlengths 3 79 | source_page_url stringclasses 189
values | source_page_title stringclasses 189
values |
|---|---|---|---|
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 `= None`
Optional frontend js method t... | Event Listeners | https://gradio.app/docs/gradio/scatterplot | Gradio - Scatterplot Docs |
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 executed first with queue=False, and on... | Event Listeners | https://gradio.app/docs/gradio/scatterplot | Gradio - Scatterplot 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 |
Server is the Gradio API engine exposed on a FastAPI application (Server
mode). It inherits from FastAPI, so all standard FastAPI methods (.get(),
.post(), .add_middleware(), .include_router(), etc.) work directly on this
instance.
New methods added on top of FastAPI: api(): Decorator to register a Gradio API
endpoin... | Description | https://gradio.app/docs/gradio/server | Gradio - Server Docs |
from gradio import Server
app = Server()
@app.api(name="hello")
def hello(name: str) -> str:
return f"Hello {name}"
@app.get("/")
def root():
return {"message": "Hello World"}
app.launch()
| Example Usage | https://gradio.app/docs/gradio/server | Gradio - Server Docs |
Parameters ▼
debug: bool
default `= False`
Enable debug mode for detailed error tracebacks.
title: str
default `= "FastAPI"`
The title of the API, shown in the OpenAPI docs.
summary: str | None
default `= None`
A short summary of the API.
description... | Initialization | https://gradio.app/docs/gradio/server | Gradio - Server Docs |
ault `= None`
An async context manager for startup/shutdown lifecycle.
terms_of_service: str | None
default `= None`
URL to the terms of service.
contact: dict[str, Any] | None
default `= None`
Contact information dict for the API.
license_info: dict[str, Any] | None... | Initialization | https://gradio.app/docs/gradio/server | Gradio - Server Docs |
server_app
| Demos | https://gradio.app/docs/gradio/server | Gradio - Server Docs |
Methods | https://gradio.app/docs/gradio/server | Gradio - Server Docs | |
%20Copyright%202022%20Fonticons,%20Inc.... | api | https://gradio.app/docs/gradio/server | Gradio - Server 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.... | api | https://gradio.app/docs/gradio/server | Gradio - Server Docs |
None`
concurrency_limit: int | None | Literal['default']
default `= "default"`
concurrency_id: str | None
default `= None`
queue: bool
default `= True`
batch: bool
default `= False`
max_batch_size: int
default `= 4`
api... | api | https://gradio.app/docs/gradio/server | Gradio - Server Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | launch | https://gradio.app/docs/gradio/server | Gradio - Server 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%203... | launch | https://gradio.app/docs/gradio/server | Gradio - Server Docs |
debug: bool
default `= False`
max_threads: int
default `= 40`
auth: Callable[[str, str], bool] | tuple[str, str] | list[tuple[str, str]] | None
default `= None`
auth_message: str | None
default `= None`
prevent_thread_lock: bool
default... | launch | https://gradio.app/docs/gradio/server | Gradio - Server Docs |
max_file_size: str | int | None
default `= None`
enable_monitoring: bool | None
default `= None`
strict_cors: bool
default `= True`
node_server_name: str | None
default `= None`
node_port: int | None
default `= None`
ssr... | launch | https://gradio.app/docs/gradio/server | Gradio - Server Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | api | https://gradio.app/docs/gradio/server | Gradio - Server 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.... | api | https://gradio.app/docs/gradio/server | Gradio - Server Docs |
None`
concurrency_limit: int | None | Literal['default']
default `= "default"`
concurrency_id: str | None
default `= None`
queue: bool
default `= True`
batch: bool
default `= False`
max_batch_size: int
default `= 4`
api... | api | https://gradio.app/docs/gradio/server | Gradio - Server Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | launch | https://gradio.app/docs/gradio/server | Gradio - Server 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%203... | launch | https://gradio.app/docs/gradio/server | Gradio - Server Docs |
debug: bool
default `= False`
max_threads: int
default `= 40`
auth: Callable[[str, str], bool] | tuple[str, str] | list[tuple[str, str]] | None
default `= None`
auth_message: str | None
default `= None`
prevent_thread_lock: bool
default... | launch | https://gradio.app/docs/gradio/server | Gradio - Server Docs |
max_file_size: str | int | None
default `= None`
enable_monitoring: bool | None
default `= None`
strict_cors: bool
default `= True`
node_server_name: str | None
default `= None`
node_port: int | None
default `= None`
ssr... | launch | https://gradio.app/docs/gradio/server | Gradio - Server Docs |
This component displays a table of value spreadsheet-like component. Can be
used to display data as an output component, or as an input to collect data
from the user.
| Description | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
**Using Dataframe as an input component.**
How Dataframe will pass its value to your function:
Type: `pd.DataFrame | np.ndarray | pl.DataFrame | list[list]`
Passes the uploaded spreadsheet data as a `pandas.DataFrame`, `numpy.array`,
`polars.DataFrame`, or native 2D Python `list[list]` depending on `type`.
Example ... | Behavior | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
Parameters ▼
value: pd.DataFrame | Styler | np.ndarray | pl.DataFrame | list | list[list] | dict | str | Callable | None
default `= None`
Default value to display in the DataFrame. Supports pandas, numpy, polars, and
list of lists. If a Styler is provided, it will be used to set the displayed
value in... | Initialization | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
t can be created in the dataframe via the UI. If the first element is None,
there is no minimum number of columns. If the second element is None, there is
no maximum number of columns. Only applies if `interactive` is True.
datatype: Literal['str', 'number', 'bool', 'date', 'markdown', 'html', 'image', ... | Initialization | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
e the component and is also used as
the header if there are a table of examples for this component. If None and
used in a `gr.Interface`, the label will be the name of the parameter this
component is assigned to.
show_label: bool | None
default `= None`
if True, will display label.
eve... | Initialization | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
e used to
display data. If not provided, this is inferred based on whether the component
is used as an input or output.
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 ex... | Initialization | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
and based on
the cell contents and the table may need to be horizontally scrolled. If
`column_width` is set, then any overflow text will be hidden.
line_breaks: bool
default `= True`
If True (default), will enable Github-flavored Markdown line breaks in chatbot
messages. If False, single new lines wil... | Initialization | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
pinned_columns: int | None
default `= None`
If provided, will pin the specified number of columns from the left.
static_columns: list[int] | None
default `= None`
List of column indices (int) that should not be editable. Only applies when
interactive=True. When specified, col_count is au... | Initialization | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
Shortcuts
gradio.Dataframe
Interface String Shortcut `"dataframe"`
Initialization Uses default values
gradio.Numpy
Interface String Shortcut `"numpy"`
Initialization Uses type="numpy"
gradio.Matrix
Interface String Shortcut `"matrix"`
Initialization Uses type="array"
... | Shortcuts | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
filter_recordsmatrix_transposetax_calculatorsort_records
| Demos | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe 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 Dataframe component supports the follow... | Event Listeners | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
nent.
inputs: Component | BlockContext | list[Component | BlockContext] | Set[Component | BlockContext] | None
default `= None`
List of gradio.components to use as inputs. If the function takes no inputs,
this should be an empty list.
outputs: Component | BlockContext | list[Component ... | Event Listeners | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
on. If None,
will show the progress animation on all of the output components.
queue: bool
default `= True`
If True, will place the request on the queue, if the queue has been enabled.
If False, will not put this event on the queue, even if the queue has been
enabled. If None, will use the queue sett... | Event Listeners | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
, 'multiple', 'always_last'] | None
default `= None`
If "once" (default for all events except `.change()`) would not allow any
submissions while an event is pending. If set to "multiple", unlimited
submissions are allowed while pending, and "always_last" (default for
`.change()` and `.key_up()` events) would allow a ... | Event Listeners | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
very: float
default `= 0.5`
key: int | str | tuple[int | str, ...] | None
default `= None`
A unique key for this event listener to be used in @gr.render(). If set, this
value identifies an event as identical across re-renders when the key is
identical.
validator: Callable | None
defa... | Event Listeners | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
Button that clears the value of a component or a list of components when
clicked. It is instantiated with the list of components to clear.
| Description | https://gradio.app/docs/gradio/clearbutton | Gradio - Clearbutton Docs |
**Using ClearButton as an input component.**
How ClearButton 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 | N... | Behavior | https://gradio.app/docs/gradio/clearbutton | Gradio - Clearbutton Docs |
Parameters ▼
components: None | list[Component] | Component
default `= None`
value: str
default `= "Clear"`
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.
... | Initialization | https://gradio.app/docs/gradio/clearbutton | Gradio - Clearbutton Docs |
ent 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
default `= None`
an optional string that is assigned as the id of this component in the ... | Initialization | https://gradio.app/docs/gradio/clearbutton | Gradio - Clearbutton Docs |
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.
api_name: str | None
default `= None... | Initialization | https://gradio.app/docs/gradio/clearbutton | Gradio - Clearbutton Docs |
Shortcuts
gradio.ClearButton
Interface String Shortcut `"clearbutton"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/clearbutton | Gradio - Clearbutton 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 ClearButton component supports the foll... | Event Listeners | https://gradio.app/docs/gradio/clearbutton | Gradio - Clearbutton 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 |
This function allows you to pass custom info messages to the user. You can
do so simply by writing `gr.Info('message here')` in your function, and when
that line is executed the custom message will appear in a modal on the demo.
The modal is gray by default and has the heading: "Info." Queue must be
enabled for this be... | Description | https://gradio.app/docs/gradio/info | Gradio - Info Docs |
import gradio as gr
def hello_world():
gr.Info('This is some info.')
return "hello world"
with gr.Blocks() as demo:
md = gr.Markdown()
demo.load(hello_world, inputs=None, outputs=[md])
demo.queue().launch()
| Example Usage | https://gradio.app/docs/gradio/info | Gradio - Info Docs |
Parameters ▼
message: str
default `= "Info issued."`
The info message to be displayed to the user. Can be HTML, which will be
rendered in the modal.
duration: float | None
default `= 10`
The duration in seconds that the info message should be displayed for. If None
or 0, the message ... | Initialization | https://gradio.app/docs/gradio/info | Gradio - Info Docs |
blocks_chained_events
[Alerts](../../guides/alerts)
| Demos | https://gradio.app/docs/gradio/info | Gradio - Info 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 |
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 |
Creates a component allows users to upload or view 3D Model files (.obj,
.glb, .stl, .gltf, .splat, or .ply).
| Description | https://gradio.app/docs/gradio/model3d | Gradio - Model3D Docs |
**Using Model3D as an input component.**
How Model3D will pass its value to your function:
Type: `str | None`
Passes the uploaded file as a `str` filepath to the function.
Example Code
import gradio as gr
def predict(
value: str | None
):
proc... | Behavior | https://gradio.app/docs/gradio/model3d | Gradio - Model3D Docs |
Parameters ▼
value: str | Callable | None
default `= None`
path to (.obj, .glb, .stl, .gltf, .splat, or .ply) file to show in model3D
viewer. If a function is provided, the function will be called each time the
app loads to set the initial value of this component.
display_mode: Literal... | Initialization | https://gradio.app/docs/gradio/model3d | Gradio - Model3D Docs |
e a positive float, increase this value
to make panning faster, decrease to make it slower. Affects the panSensibility
property of the camera.
height: int | str | None
default `= None`
The height of the model3D component, specified in pixels if a number is
passed, or in CSS units if a string is passed... | Initialization | https://gradio.app/docs/gradio/model3d | Gradio - Model3D Docs |
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.
interactive: bool | None
default `= None`
if True, will allow users to upload a file; if False, can only b... | Initialization | https://gradio.app/docs/gradio/model3d | Gradio - Model3D Docs |
(if they have been changed by
the user or an event listener) instead of re-rendered based on the values
provided during 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... | Initialization | https://gradio.app/docs/gradio/model3d | Gradio - Model3D Docs |
Shortcuts
gradio.Model3D
Interface String Shortcut `"model3d"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/model3d | Gradio - Model3D 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 Model3D component supports the followin... | Event Listeners | https://gradio.app/docs/gradio/model3d | Gradio - Model3D Docs |
tion 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 should be an empty list.
... | Event Listeners | https://gradio.app/docs/gradio/model3d | Gradio - Model3D Docs |
d.
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 a list of input values for each paramet... | Event Listeners | https://gradio.app/docs/gradio/model3d | Gradio - Model3D Docs |
ubmissions 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 running 'fn'. Input arguments for js
m... | Event Listeners | https://gradio.app/docs/gradio/model3d | Gradio - Model3D Docs |
ies an event as identical across re-renders when the key is
identical.
validator: Callable | None
default `= None`
Optional validation function to run before the main function. If provided,
this function will be executed first with queue=False, and only if it
completes successfully will the main funct... | Event Listeners | https://gradio.app/docs/gradio/model3d | Gradio - Model3D 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 |
e 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 should be an empty list.
... | Event Listeners | https://gradio.app/docs/gradio/dataset | Gradio - Dataset Docs |
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 a list of input values for each p... | Event Listeners | https://gradio.app/docs/gradio/dataset | Gradio - Dataset Docs |
ited
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 running 'fn'. Input arguments fo... | Event Listeners | https://gradio.app/docs/gradio/dataset | Gradio - Dataset Docs |
dentifies an event as identical across re-renders when the key is
identical.
validator: Callable | None
default `= None`
Optional validation function to run before the main function. If provided,
this function will be executed first with queue=False, and only if it
completes successfully will the main... | Event Listeners | https://gradio.app/docs/gradio/dataset | Gradio - Dataset Docs |
Constructs a Gradio app automatically from a Hugging Face model/Space repo
name or a 3rd-party API provider. Note that if a Space repo is loaded, certain
high-level attributes of the Blocks (e.g. custom `css`, `js`, and `head`
attributes) will not be loaded.
| Description | https://gradio.app/docs/gradio/load | Gradio - Load Docs |
import gradio as gr
demo = gr.load("gradio/question-answering", src="spaces")
demo.launch()
| Example Usage | https://gradio.app/docs/gradio/load | Gradio - Load Docs |
Parameters ▼
name: str
the name of the model (e.g. "google/vit-base-patch16-224") or Space (e.g.
"flax-community/spanish-gpt2"). This is the first parameter passed into the
`src` function. Can also be formatted as {src}/{repo name} (e.g.
"models/google/vit-base-patch16-224") if `src` is not provided.
... | Initialization | https://gradio.app/docs/gradio/load | Gradio - Load Docs |
DER_T | None
default `= None`
the name of the third-party (non-Hugging Face) providers to use for model
inference (e.g. "replicate", "sambanova", "fal-ai", etc). Should be one of the
providers supported by `huggingface_hub.InferenceClient`. This parameter is
only used when `src` is "models"
kwargs:
... | Initialization | https://gradio.app/docs/gradio/load | Gradio - Load Docs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.