text stringlengths 0 2k | heading1 stringlengths 3 79 | source_page_url stringclasses 186
values | source_page_title stringclasses 186
values |
|---|---|---|---|
ta.index and SelectData.value. See
SelectData documentation on how to use this event data.
HTML.option_select(fn, ···)
This listener is triggered when the user clicks on an option from within the
HTML. This event has SelectData of type gradio.SelectData that carries
information, accessible through Selec... | Event Listeners | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
e
as a FileData object. See EventData documentation on how to use this event
data
HTML.copy(fn, ···)
This listener is triggered when the user copies content from the HTML. Uses
event data gradio.CopyData to carry information about the copied content. See
EventData documentation on how to use this event ... | Event Listeners | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
he function's docstring will be used as the API
endpoint description. If False, then no description will be displayed in the
API docs.
scroll_to_output: bool
default `= False`
If True, will scroll to output component on completion
show_progress: Literal['full', 'minimal', 'hidden']
de... | Event Listeners | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
g 'fn'
(e.g. leaving it as a base64 string if this method is called with the `Image`
component).
postprocess: bool
default `= True`
If False, will not run postprocessing of component data before returning 'fn'
output to the browser.
cancels: dict[str, Any] | list[dict[str, Any]] | None... | Event Listeners | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
1 by default).
concurrency_id: str | None
default `= None`
If set, this is the id of the concurrency group. Events with the same
concurrency_id will be limited by the lowest set concurrency_limit.
api_visibility: Literal['public', 'private', 'undocumented']
default `= "public"`
contr... | Event Listeners | https://gradio.app/docs/gradio/html | Gradio - Html 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 |
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 |
e
not yet run (or generators that are iterating) will be cancelled, but
functions that are currently running will be allowed to finish.
trigger_mode: Literal['once', 'multiple', 'always_last'] | None
default `= None`
If "once" (default for all events except `.change()`) would not allow any
submissions... | Event Listeners | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
by clients and via gr.load). If fn is None,
api_visibility will automatically be set to "private".
time_limit: int | None
default `= None`
stream_every: float
default `= 0.5`
key: int | str | tuple[int | str, ...] | None
default `= None`
A unique key for this event li... | Event Listeners | https://gradio.app/docs/gradio/dropdown | Gradio - Dropdown Docs |
Creates a code editor for viewing code (as an output component), or for
entering and editing code (as an input component).
| Description | https://gradio.app/docs/gradio/code | Gradio - Code Docs |
**Using Code as an input component.**
How Code will pass its value to your function:
Type: `str | None`
Passes the code entered as a `str`.
Example Code
import gradio as gr
def predict(
value: str | None
):
process value from the Code componen... | Behavior | https://gradio.app/docs/gradio/code | Gradio - Code Docs |
Parameters ▼
value: str | Callable | None
default `= None`
Default value to show in the code editor. If a function is provided, the
function will be called each time the app loads to set the initial value of
this component.
language: Literal['python', 'c', 'cpp', 'markdown', 'latex', '... | Initialization | https://gradio.app/docs/gradio/code | Gradio - Code Docs |
component is assigned to.
interactive: bool | None
default `= None`
Whether user should be able to enter code or only view it.
show_label: bool | None
default `= None`
if True, will display label.
container: bool
default `= True`
If True, will place the component i... | Initialization | https://gradio.app/docs/gradio/code | Gradio - Code Docs |
ey: int | str | tuple[int | str, ...] | None
default `= None`
in a gr.render, Components with the same key across re-renders are treated as
the same component, not a new component. Properties set in 'preserved_by_key'
are not reset across a re-render.
preserved_by_key: list[str] | str | None
default ... | Initialization | https://gradio.app/docs/gradio/code | Gradio - Code Docs |
Shortcuts
gradio.Code
Interface String Shortcut `"code"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/code | Gradio - Code 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 Code component supports the following e... | Event Listeners | https://gradio.app/docs/gradio/code | Gradio - Code Docs |
Creates an image component that, as an input, can be used to upload and
edit images using simple editing tools such as brushes, strokes, cropping, and
layers. Or, as an output, this component can be used to display images.
| Description | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
**Using ImageEditor as an input component.**
How ImageEditor will pass its value to your function:
Type: `EditorValue | None`
Passes the uploaded images as an instance of EditorValue, which is just a
`dict` with keys: 'background', 'layers', and 'composite'.
* The values corresponding to 'background' and 'composi... | Behavior | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
Parameters ▼
value: EditorValue | ImageType | None
default `= None`
Optional initial image(s) to populate the image editor. Should be a dictionary
with keys: `background`, `layers`, and `composite`. The values corresponding
to `background` and `composite` should be images or None, while `layers`
shoul... | Initialization | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
webcam', 'clipboard'] | None
default `= ('upload', 'webcam', 'clipboard')`
List of sources that can be used to set the background image. "upload" creates
a box where user can drop an image file, "webcam" allows user to take snapshot
from their webcam, "clipboard" allows users to paste an image from the
clipboard.
... | Initialization | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
nt. Valid options are
"download" to download the image, "share" to share to Hugging Face Spaces
Discussions, and "fullscreen" to view in fullscreen mode. By default, all
buttons are shown.
container: bool
default `= True`
If True, will place the component in a container - providing some extra
padding ... | Initialization | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
r: bool
default `= True`
If False, component will not render be rendered in the Blocks context. Should
be used if the intention is to assign event listeners now but render the
component later.
key: int | str | tuple[int | str, ...] | None
default `= None`
in a gr.render, Components with the same key... | Initialization | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
also hide the eraser tool. See `gr.Brush`
docs.
format: str
default `= "webp"`
Format to save image if it does not already have a valid format (e.g. if the
image is being returned to the frontend as a numpy array or PIL Image). The
format should be supported by the PIL library. This parameter has no e... | Initialization | https://gradio.app/docs/gradio/imageeditor | Gradio - Imageeditor Docs |
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 an image component that can be used to upload images (as an input)
or display images (as an output).
| Description | https://gradio.app/docs/gradio/imageslider | Gradio - Imageslider Docs |
**Using ImageSlider as an input component.**
How ImageSlider will pass its value to your function:
Type: `image_tuple | None`
Passes the uploaded image as a tuple of `numpy.array`, `PIL.Image` or `str`
filepath depending on `type`.
Example Code
import gradio as gr
def predic... | Behavior | https://gradio.app/docs/gradio/imageslider | Gradio - Imageslider Docs |
Parameters ▼
value: image_tuple | Callable | None
default `= None`
A tuple of PIL Image, numpy array, path or URL for the default value that
ImageSlider component is going to take, this pair of images should be of equal
size. If a function is provided, the function will be called each time the app
loa... | Initialization | https://gradio.app/docs/gradio/imageslider | Gradio - Imageslider Docs |
image_mode will be inferred
from the image file types (e.g. "RGBA" for a .png image, "RGB" in most other
cases).
type: Literal['numpy', 'pil', 'filepath']
default `= "numpy"`
The format the images are converted to before being passed into the prediction
function. "numpy" converts the images to numpy a... | Initialization | https://gradio.app/docs/gradio/imageslider | Gradio - Imageslider Docs |
ce. The
"download" button allows the user to download the image. The "fullscreen"
button allows the user to view the image in fullscreen mode. Custom
gr.Button() instances will appear in the toolbar with their configured icon
and/or label, and clicking them will trigger any .click() events registered on
the button. by ... | Initialization | https://gradio.app/docs/gradio/imageslider | Gradio - Imageslider Docs |
None
default `= None`
An optional list of strings that are assigned as the classes of this component
in the HTML DOM. Can be used for targeting CSS styles.
render: bool
default `= True`
If False, component will not render be rendered in the Blocks context. Should
be used if the intention is to assig... | Initialization | https://gradio.app/docs/gradio/imageslider | Gradio - Imageslider Docs |
Shortcuts
gradio.ImageSlider
Interface String Shortcut `"imageslider"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/imageslider | Gradio - Imageslider Docs |
imageslider
| Demos | https://gradio.app/docs/gradio/imageslider | Gradio - Imageslider 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 ImageSlider component supports the foll... | Event Listeners | https://gradio.app/docs/gradio/imageslider | Gradio - Imageslider Docs |
red. 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.
inputs: Component | BlockContext | list[... | Event Listeners | https://gradio.app/docs/gradio/imageslider | Gradio - Imageslider Docs |
e 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 show the progress animation on all of the o... | Event Listeners | https://gradio.app/docs/gradio/imageslider | Gradio - Imageslider Docs |
nt
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', 'always_last'] | None
default `= None`
If "onc... | Event Listeners | https://gradio.app/docs/gradio/imageslider | Gradio - Imageslider Docs |
radio 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 `= 0.5`
key: int | str | ... | Event Listeners | https://gradio.app/docs/gradio/imageslider | Gradio - Imageslider Docs |
The Dependency object is usually not created directly but is returned when
an event listener is set up. It contains the configuration data for the event
listener, and can be used to set up additional event listeners that depend on
the completion of the current event listener using .then(), .success(), and
.failure(). ... | Description | https://gradio.app/docs/gradio/dependency | Gradio - Dependency Docs |
import gradio as gr
with gr.Blocks() as demo:
first_textbox = gr.Textbox()
second_textbox = gr.Textbox()
button = gr.Button("Submit")
dependency = button.click(lambda x: "Hello, " + x, first_textbox, second_textbox)
dependency.success(lambda: gr.Info("Greeting succ... | Example Usage | https://gradio.app/docs/gradio/dependency | Gradio - Dependency Docs |
chatbot_consecutiveblocks_chained_events
| Demos | https://gradio.app/docs/gradio/dependency | Gradio - Dependency Docs |
The gr.UndoData class is a subclass of gr.Event data that specifically
carries information about the `.undo()` event. When gr.UndoData is added as a
type hint to an argument of an event listener method, a gr.UndoData object
will automatically be passed as the value of that argument. The attributes of
this object contai... | Description | https://gradio.app/docs/gradio/undodata | Gradio - Undodata Docs |
import gradio as gr
def undo(retry_data: gr.UndoData, history: list[gr.MessageDict]):
history_up_to_retry = history[:retry_data.index]
return history_up_to_retry
with gr.Blocks() as demo:
chatbot = gr.Chatbot()
chatbot.undo(undo, chatbot, chatbot)
demo.launch()
| Example Usage | https://gradio.app/docs/gradio/undodata | Gradio - Undodata Docs |
Parameters ▼
index: int | tuple[int, int]
The index of the user message that should be undone.
value: Any
The value of the user message that should be undone.
| Attributes | https://gradio.app/docs/gradio/undodata | Gradio - Undodata Docs |
Displays text that contains spans that are highlighted by category or
numerical value.
| Description | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
**Using HighlightedText as an input component.**
How HighlightedText will pass its value to your function:
Type: `list[tuple[str, str | float | None]] | None`
Passes the value as a list of tuples: `list[tuple]`. Each `tuple` consists of:
* a `str` substring of the text (so the entire text is included)
* a `str... | Behavior | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
Parameters ▼
value: list[tuple[str, str | float | None]] | dict | Callable | None
default `= None`
Default value to show. If a function is provided, the function will be called
each time the app loads to set the initial value of this component.
color_map: dict[str, str] | None
default... | Initialization | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
inputs: Component | list[Component] | set[Component] | None
default `= None`
Components that are used as inputs to calculate `value` if `value` is a
function (has no effect otherwise). `value` is recalculated any time the
inputs change.
show_label: bool | None
default `= None`
if True, will display... | Initialization | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
e intention is to assign event listeners now but render the
component later.
key: int | str | tuple[int | str, ...] | None
default `= None`
in a gr.render, Components with the same key across re-renders are treated as
the same component, not a new component. Properties set in 'preserved_by_key'
are no... | Initialization | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
Shortcuts
gradio.HighlightedText
Interface String Shortcut `"highlightedtext"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
diff_texts
| Demos | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
Description
Event listeners allow you to respond to user interactions with the UI
components you've defined in a Gradio Blocks app. When a user interacts with
an element, such as changing a slider value or uploading an image, a function
is called.
Supported Event Listeners
The HighlightedText component supports the ... | Event Listeners | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
puts,
this should be an empty list.
outputs: Component | BlockContext | list[Component | BlockContext] | Set[Component | BlockContext] | None
default `= None`
List of gradio.components to use as outputs. If the function returns no
outputs, this should be an empty list.
api_name: str | ... | Event Listeners | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
l not put this event on the queue, even if the queue has been
enabled. If None, will use the queue setting of the gradio app.
batch: bool
default `= False`
If True, then the function should process a batch of inputs, meaning that it
should accept a list of input values for each parameter. The lists sh... | Event Listeners | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
llowed while pending, and "always_last" (default for
`.change()` and `.key_up()` events) would allow a second submission after the
pending event is complete.
js: str | Literal[True] | None
default `= None`
Optional frontend js method to run before running 'fn'. Input arguments for js
method are values... | Event Listeners | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
identical across re-renders when the key is
identical.
validator: Callable | None
default `= None`
Optional validation function to run before the main function. If provided,
this function will be executed first with queue=False, and only if it
completes successfully will the main function be called. T... | Event Listeners | https://gradio.app/docs/gradio/highlightedtext | Gradio - Highlightedtext Docs |
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 |
This class is a wrapper over the Dataset component and can be used to
create Examples for Blocks / Interfaces. Populates the Dataset component with
examples and assigns event listener so that clicking on an example populates
the input/output components. Optionally handles example caching for fast
inference.
| Description | https://gradio.app/docs/gradio/examples | Gradio - Examples Docs |
Parameters ▼
examples: list[Any] | list[list[Any]] | str
example inputs that can be clicked to populate specific components. Should be
nested list, in which the outer list consists of samples and each inner list
consists of an input corresponding to each input component. A string path to a
directory of... | Initialization | https://gradio.app/docs/gradio/examples | Gradio - Examples Docs |
d in Gradio's
UI for cached examples.
cache_mode: Literal['eager', 'lazy'] | None
default `= None`
if "lazy", examples are cached after their first use. If "eager", all examples
are cached at app launch. If None, will use the GRADIO_CACHE_MODE environment
variable if defined, or default to "eager".
... | Initialization | https://gradio.app/docs/gradio/examples | Gradio - Examples Docs |
ow the event associated with clicking on the examples 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, an auto-generated name
will be used.
api_description: str | None | Literal[False]
default `= None`
Desc... | Initialization | https://gradio.app/docs/gradio/examples | Gradio - Examples Docs |
Parameters ▼
dataset: gradio.Dataset
The `gr.Dataset` component corresponding to this Examples object.
load_input_event: gradio.events.Dependency
The Gradio event that populates the input values when the examples are
clicked. You can attach a `.then()` or a `.success()` to this event t... | Attributes | https://gradio.app/docs/gradio/examples | Gradio - Examples Docs |
**Updating Examples**
In this demo, we show how to update the examples by updating the samples of
the underlying dataset. Note that this only works if `cache_examples=False` as
updating the underlying dataset does not update the cache.
import gradio as gr
def update_examples(country):
i... | Examples | https://gradio.app/docs/gradio/examples | Gradio - Examples Docs |
calculator_blocks
| Demos | https://gradio.app/docs/gradio/examples | Gradio - Examples 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.