text stringlengths 0 2k | heading1 stringlengths 3 79 | source_page_url stringclasses 188
values | source_page_title stringclasses 188
values |
|---|---|---|---|
chatbot_consecutiveblocks_chained_events
| Demos | https://gradio.app/docs/gradio/dependency | Gradio - Dependency Docs |
Column is a layout element within Blocks that renders all children
vertically. The widths of columns can be set through the `scale` and
`min_width` parameters. If a certain scale results in a column narrower than
min_width, the min_width parameter will win.
| Description | https://gradio.app/docs/gradio/column | Gradio - Column Docs |
with gr.Blocks() as demo:
with gr.Row():
with gr.Column(scale=1):
text1 = gr.Textbox()
text2 = gr.Textbox()
with gr.Column(scale=4):
btn1 = gr.Button("Button 1")
btn2 = gr.Button("Button 2")
| Example Usage | https://gradio.app/docs/gradio/column | Gradio - Column Docs |
Parameters βΌ
scale: int
default `= 1`
relative width compared to adjacent Columns. For example, if Column A has
scale=2, and Column B has scale=1, A will be twice as wide as B.
min_width: int
default `= 320`
minimum pixel width of Column, will wrap if not sufficient screen space to
s... | Initialization | https://gradio.app/docs/gradio/column | Gradio - Column Docs |
ved_by_key: list[str] | str | None
default `= None`
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 user or an event listener) instead... | Initialization | https://gradio.app/docs/gradio/column | Gradio - Column Docs |
Gradio includes pre-built components that can be used as inputs or outputs
in your Interface or Blocks with a single line of code. Components include
preprocessing steps that convert user data submitted through browser to
something that be can used by a Python function, and postprocessing steps to
convert values return... | Introduction | https://gradio.app/docs/gradio/introduction | Gradio - Introduction Docs |
Components also come with certain events that they support. These are
methods that are triggered with user actions. Below is a table showing which
events are supported for each component. All events are also listed (with
parameters) in the componentβs docs.
| play| stop| option_select| delete| copy| key_up| expand| un... | Events | https://gradio.app/docs/gradio/introduction | Gradio - Introduction Docs |
| β| β| β
[Code](code)| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β|
β| β| β| β| β| β| β| β| β| β| β| β| β| β| β
[ColorPicker](colorpicker)| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β|
β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β
[Dataframe](dataframe)| β| β| β| β| β| β| β| β| ... | Events | https://gradio.app/docs/gradio/introduction | Gradio - Introduction Docs |
β| β| β| β| β| β| β| β| β| β| β|
β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β
[HighlightedText](highlightedtext)| β| β| β| β| β| β| β| β| β| β| β| β| β| β|
β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β
[HTML](html)| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β|
β| β| β| β| ... | Events | https://gradio.app/docs/gradio/introduction | Gradio - Introduction Docs |
ScatterPlot](scatterplot)| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β|
β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β
[Navbar](navbar)| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β|
β| β| β| β| β| β| β| β| β| β| β| β| β| β| β| β
[Number](number)| β| β| β| β| β| β| β| β| β| β| β| β| β| ... | Events | https://gradio.app/docs/gradio/introduction | Gradio - Introduction Docs |
Creates a slider that ranges from `minimum` to `maximum` with a step size
of `step`.
| Description | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
**Using Slider as an input component.**
How Slider will pass its value to your function:
Type: `float`
Passes slider value as a `float` into the function.
Example Code
import gradio as gr
def predict(
value: float
):
process value from the Sli... | Behavior | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
Parameters βΌ
minimum: float
default `= 0`
minimum value for slider. When used as an input, if a user provides a smaller
value, a gr.Error exception is raised by the backend.
maximum: float
default `= 100`
maximum value for slider. When used as an input, if a user provides a larger
va... | Initialization | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
sed as inputs to calculate `value` if `value` is a
function (has no effect otherwise). `value` is recalculated any time the
inputs change.
show_label: bool | None
default `= None`
if True, will display label.
container: bool
default `= True`
If True, will place the component in a con... | Initialization | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
render: 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 t... | Initialization | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
Shortcuts
gradio.Slider
Interface String Shortcut `"slider"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
Logarithmic scale
Sliders are linear by default. For parameters that vary over several orders of
magnitude (e.g. learning rate), map the slider value inside your function:
import gradio as gr
def train(lr_exp):
lr = 10 ** lr_exp slider value -5 β lr 0.00001
return f"Training wi... | Common Patterns | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
sentence_builderslider_releaseinterface_random_sliderblocks_random_slider
| Demos | https://gradio.app/docs/gradio/slider | Gradio - Slider 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 Slider component supports the following... | Event Listeners | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
| 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 endpoint will be exposed in ... | Event Listeners | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
ol
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 (even if there is only 1 out... | Event Listeners | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
plete.
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: int | None | Literal['default']... | Event Listeners | https://gradio.app/docs/gradio/slider | Gradio - Slider Docs |
n 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/slider | Gradio - Slider Docs |
Accordion is a layout element which can be toggled to show/hide the
contained content.
| Description | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
with gr.Accordion("See Details"):
gr.Markdown("lorem ipsum")
| Example Usage | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
Parameters βΌ
label: str | I18nData | None
default `= None`
name of accordion section.
open: bool
default `= True`
if True, accordion is open by default.
visible: bool | Literal['hidden']
default `= True`
elem_id: str | None
default `= None`
An optio... | Initialization | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
Methods | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs | |
%20Copyright%202022%20Fonticons,%20Inc.... | expand | https://gradio.app/docs/gradio/accordion | Gradio - Accordion 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%... | expand | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
onds 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 gradi... | expand | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
ion 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 ... | expand | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
enerators 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 ... | expand | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
gr.load). If fn is None,
api_visibility will automatically be set to "private".
time_limit: int | None
default `= None`
stream_every: float
default `= 0.5`
key: int | str | tuple[int | str, ...] | None
default `= None`
A unique key for this event listener to be used i... | expand | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | collapse | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.... | collapse | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
esponds 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 gr... | collapse | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
mation 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 reque... | collapse | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
r generators that are iterating) will be cancelled, but
functions that are currently running will be allowed to finish.
trigger_mode: Literal['once', 'multiple', 'always_last'] | None
default `= None`
If "once" (default for all events except `.change()`) would not allow any
submissions while an event ... | collapse | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
ia gr.load). If fn is None,
api_visibility will automatically be set to "private".
time_limit: int | None
default `= None`
stream_every: float
default `= 0.5`
key: int | str | tuple[int | str, ...] | None
default `= None`
A unique key for this event listener to be use... | collapse | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | expand | https://gradio.app/docs/gradio/accordion | Gradio - Accordion 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%... | expand | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
onds 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 gradi... | expand | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
ion 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 ... | expand | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
enerators 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 ... | expand | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
gr.load). If fn is None,
api_visibility will automatically be set to "private".
time_limit: int | None
default `= None`
stream_every: float
default `= 0.5`
key: int | str | tuple[int | str, ...] | None
default `= None`
A unique key for this event listener to be used i... | expand | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | collapse | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.... | collapse | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
esponds 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 gr... | collapse | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
mation 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 reque... | collapse | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
r generators that are iterating) will be cancelled, but
functions that are currently running will be allowed to finish.
trigger_mode: Literal['once', 'multiple', 'always_last'] | None
default `= None`
If "once" (default for all events except `.change()`) would not allow any
submissions while an event ... | collapse | https://gradio.app/docs/gradio/accordion | Gradio - Accordion Docs |
ia gr.load). If fn is None,
api_visibility will automatically be set to "private".
time_limit: int | None
default `= None`
stream_every: float
default `= 0.5`
key: int | str | tuple[int | str, ...] | None
default `= None`
A unique key for this event listener to be use... | collapse | https://gradio.app/docs/gradio/accordion | Gradio - Accordion 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 |
his 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.
label: str |... | Initialization | https://gradio.app/docs/gradio/model3d | Gradio - Model3D Docs |
reen 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 be used to
display files. If not... | Initialization | https://gradio.app/docs/gradio/model3d | Gradio - Model3D Docs |
he 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 with their configured
icon and... | 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 |
Button that triggers a Spaces Duplication, when the demo is on Hugging Face
Spaces. Does nothing locally.
| Description | https://gradio.app/docs/gradio/duplicatebutton | Gradio - Duplicatebutton Docs |
**Using DuplicateButton as an input component.**
How DuplicateButton 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:... | Behavior | https://gradio.app/docs/gradio/duplicatebutton | Gradio - Duplicatebutton Docs |
Parameters βΌ
value: str
default `= "Duplicate Space"`
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 calls `va... | Initialization | https://gradio.app/docs/gradio/duplicatebutton | Gradio - Duplicatebutton Docs |
he 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 HTML
DOM. Can be used for targeting CSS styles.
... | Initialization | https://gradio.app/docs/gradio/duplicatebutton | Gradio - Duplicatebutton Docs |
m pixel width, will wrap if not sufficient screen space to satisfy this
value. If a certain scale value results in this Component being narrower than
min_width, the min_width parameter will be respected first.
| Initialization | https://gradio.app/docs/gradio/duplicatebutton | Gradio - Duplicatebutton Docs |
Shortcuts
gradio.DuplicateButton
Interface String Shortcut `"duplicatebutton"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/duplicatebutton | Gradio - Duplicatebutton 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 DuplicateButton component supports the ... | Event Listeners | https://gradio.app/docs/gradio/duplicatebutton | Gradio - Duplicatebutton Docs |
description: str | None | Literal[False]
default `= None`
Description of the API endpoint. Can be a string, None, or False. If set to a
string, the endpoint will be exposed in the API docs with the given
description. If None, the function's docstring will be used as the API
endpoint description. If False, then no des... | Event Listeners | https://gradio.app/docs/gradio/duplicatebutton | Gradio - Duplicatebutton Docs |
`
Maximum number of inputs to batch together if this is called from the queue
(only relevant if batch=True)
preprocess: bool
default `= True`
If False, will not run preprocessing of component data before running 'fn'
(e.g. leaving it as a base64 string if this method is called with the `Image`
compon... | Event Listeners | https://gradio.app/docs/gradio/duplicatebutton | Gradio - Duplicatebutton Docs |
mean no concurrency_limit (any number of
this event can be running simultaneously). Set to "default" to use the default
concurrency limit (defined by the `default_concurrency_limit` parameter in
`Blocks.queue()`, which itself is 1 by default).
concurrency_id: str | None
default `= None`
If set, this i... | Event Listeners | https://gradio.app/docs/gradio/duplicatebutton | Gradio - Duplicatebutton Docs |
Creates a video component that can be used to upload/record videos (as an
input) or display videos (as an output). For the video to be playable in the
browser it must have a compatible container and codec combination. Allowed
combinations are .mp4 with h264 codec, .ogg with theora codec, and .webm with
vp9 codec. If th... | Description | https://gradio.app/docs/gradio/video | Gradio - Video Docs |
**Using Video as an input component.**
How Video will pass its value to your function:
Type: `str | None`
Passes the uploaded video as a `str` filepath or URL whose extension can be
modified by `format`.
Example Code
import gradio as gr
def predict(
value: str | ... | Behavior | https://gradio.app/docs/gradio/video | Gradio - Video Docs |
Parameters βΌ
value: str | Path | Callable | None
default `= None`
path or URL for the default value that Video component is going to take. Or
can be callable, in which case the function will be called whenever the app
loads to set the initial value of the component.
format: str | None
... | Initialization | https://gradio.app/docs/gradio/video | Gradio - Video Docs |
nd
used in a `gr.Interface`, the label will be the name of the parameter this
component is assigned to.
every: Timer | float | None
default `= None`
continously calls `value` to recalculate it if `value` is a function (has no
effect otherwise). Can provide a Timer whose tick resets `value`, or a float... | Initialization | https://gradio.app/docs/gradio/video | Gradio - Video Docs |
e 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 component in the HTML
DOM. Can be used for targeting CSS styles.
elem_class... | Initialization | https://gradio.app/docs/gradio/video | Gradio - Video Docs |
lt `= None`
whether the component should record/retain the audio track for a video. By
default, audio is excluded for webcam videos and included for uploaded videos.
autoplay: bool
default `= False`
whether to automatically play the video when the component is used as an
output. Note: browsers will n... | Initialization | https://gradio.app/docs/gradio/video | Gradio - Video Docs |
position on the video. Valid formats for the image are: jpeg,
png.
subtitles: str | Path | list[dict[str, Any]] | None
default `= None`
A subtitle file (srt, vtt, or json) for the video, or a list of subtitle
dictionaries in the format [{"text": str, "timestamp": [start, end]}] where
timestamps are i... | Initialization | https://gradio.app/docs/gradio/video | Gradio - Video Docs |
Shortcuts
gradio.Video
Interface String Shortcut `"video"`
Initialization Uses default values
gradio.PlayableVideo
Interface String Shortcut `"playablevideo"`
Initialization Uses format="mp4"
| Shortcuts | https://gradio.app/docs/gradio/video | Gradio - Video Docs |
video_identity_2
| Demos | https://gradio.app/docs/gradio/video | Gradio - Video 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 Video component supports the following ... | Event Listeners | https://gradio.app/docs/gradio/video | Gradio - Video Docs |
d when the user changes the value of the Video.
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 parameter of the function corresponds to one
... | Event Listeners | https://gradio.app/docs/gradio/video | Gradio - Video Docs |
s: 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, "hidden"
shows no progress animation at ... | Event Listeners | https://gradio.app/docs/gradio/video | Gradio - Video Docs |
ict[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. Functions that have
not yet run (or generato... | Event Listeners | https://gradio.app/docs/gradio/video | Gradio - Video Docs |
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 docs but callable by clients and via gr.load... | Event Listeners | https://gradio.app/docs/gradio/video | Gradio - Video Docs |
Helper Classes | https://gradio.app/docs/gradio/video | Gradio - Video 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/video | Gradio - Video Docs |
Validates that the audio length is within the specified min and max length (in
seconds). You can use this to construct a validator that will check if the
user-provided audio is either too short or too long.
import gradio as gr
demo = gr.Interface(
lambda x: x,
inputs="video",
... | is_video_correct_length | https://gradio.app/docs/gradio/video | Gradio - Video Docs |
Creates a dropdown of choices from which a single entry or multiple entries
can be selected (as an input component) or displayed (as an output component).
| Description | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
**Using Dropdown as an input component.**
How Dropdown will pass its value to your function:
Type: `str | int | float | list[str | int | float] | list[int | None] | None`
Passes the value of the selected dropdown choice as a `str | int | float` or its index as an `int` into the function, depending on `type`. Or, if ... | Behavior | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
Parameters βΌ
choices: list[str | int | float | tuple[str, str | int | float]] | None
default `= None`
a list of string or numeric options to choose from. An option can also be a
tuple of the form (name, value), where name is the displayed name of the
dropdown choice and value is the value to be passed... | Initialization | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
`show_label` is
`True` 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 corresponds to.
info: str | I18nData | None
default `= None`
additional component description, app... | Initialization | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
ne`
if True, choices in this dropdown will be selectable; if False, selection will
be disabled. 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... | Initialization | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
Shortcuts
gradio.Dropdown
Interface String Shortcut `"dropdown"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
sentence_builder
| Demos | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown 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 Dropdown component supports the followi... | Event Listeners | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
he function corresponds to one
input component, and the function should return a single value or a tuple of
values, with each element in the tuple corresponding to one output component.
inputs: Component | BlockContext | list[Component | BlockContext] | Set[Component | BlockContext] | None
default `= N... | Event Listeners | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
no progress animation at all
show_progress_on: Component | list[Component] | None
default `= None`
Component or list of components to show the progress animation on. If None,
will show the progress animation on all of the output components.
queue: bool
default `= True`
If True, will... | Event Listeners | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.