text stringlengths 0 2k | heading1 stringlengths 3 79 | source_page_url stringclasses 189
values | source_page_title stringclasses 189
values |
|---|---|---|---|
%20Copyright%202022%20Fonticons,%20Inc.... | load | https://gradio.app/docs/gradio/blocks | Gradio - Blocks 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.... | load | https://gradio.app/docs/gradio/blocks | Gradio - Blocks Docs |
ction 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[Component | BlockContext] | Set[Component |... | load | https://gradio.app/docs/gradio/blocks | Gradio - Blocks Docs |
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 output components.
queue: bo... | load | https://gradio.app/docs/gradio/blocks | Gradio - Blocks Docs |
s .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 "once" (default for all events except `.change(... | load | https://gradio.app/docs/gradio/blocks | Gradio - Blocks Docs |
(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 | tuple[int | str, ...] | None
default `= No... | load | https://gradio.app/docs/gradio/blocks | Gradio - Blocks Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | unload | https://gradio.app/docs/gradio/blocks | Gradio - Blocks 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.4... | unload | https://gradio.app/docs/gradio/blocks | Gradio - Blocks Docs |
--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%20... | unload | https://gradio.app/docs/gradio/blocks | Gradio - Blocks Docs |
ources. The function should not take any
arguments and the output is not used.
| unload | https://gradio.app/docs/gradio/blocks | Gradio - Blocks Docs |
Creates a component with arbitrary HTML. Can include CSS and JavaScript to
create highly customized and interactive components.
| Description | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
**Using HTML as an input component.**
How HTML will pass its value to your function:
Type: `str | None`
(Rarely used) passes the HTML as a `str`.
Example Code
import gradio as gr
def predict(
value: str | None
):
process value from the HTML co... | Behavior | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
Parameters ▼
value: Any | Callable | None
default `= None`
The HTML content in the ${value} tag in the html_template. For example, if
html_template="<p>${value}</p>" and value="Hello, world!", the component will
render as `"<p>Hello, world!</p>"`.
label: str | I18nData | None
default ... | Initialization | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
()`. The `trigger` function can be used to trigger
events, such as `trigger('click')`. The value and other props can be edited
through `props`, e.g. `props.value = "new value"` which will re-render the
HTML template. If `server_functions` is provided, a `server` object is also
available in `js_on_load`, where each func... | Initialization | https://gradio.app/docs/gradio/html | Gradio - Html 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=T... | Initialization | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
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 of re-rendered based on the values
provided during constructor.
min_height: in... | Initialization | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
d for `<script>` and `<link>` tags to load third-party
libraries. Scripts are deduplicated by `src` and links by `href`, so multiple
components requiring the same library won't load it twice.
server_functions: list[Callable] | None
default `= None`
A list of Python functions that can be called from `j... | Initialization | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
Shortcuts
gradio.HTML
Interface String Shortcut `"html"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
super_html
| Demos | https://gradio.app/docs/gradio/html | Gradio - Html 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 HTML component supports the following e... | Event Listeners | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
, ···)
This listener is triggered when the user reaches the end of the media playing
in the HTML.
HTML.start_recording(fn, ···)
This listener is triggered when the user starts recording with the HTML.
HTML.pause_recording(fn, ···)
This listener is triggered when the user pauses recordin... | Event Listeners | https://gradio.app/docs/gradio/html | Gradio - Html Docs |
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 |
A TabbedInterface is created by providing a list of Interfaces or Blocks,
each of which gets rendered in a separate tab. Only the components from the
Interface/Blocks will be rendered in the tab.
| Description | https://gradio.app/docs/gradio/tabbedinterface | Gradio - Tabbedinterface Docs |
Parameters ▼
interface_list: list[Blocks]
A list of Interfaces (or Blocks) to be rendered in the tabs.
tab_names: list[str] | None
default `= None`
A list of tab names. If None, the tab names will be "Tab 1", "Tab 2", etc.
title: str | None
default `= None`
The tab t... | Initialization | https://gradio.app/docs/gradio/tabbedinterface | Gradio - Tabbedinterface Docs |
tabbed_interface_lite
| Demos | https://gradio.app/docs/gradio/tabbedinterface | Gradio - Tabbedinterface Docs |
Sets up an event listener that triggers a function when the specified
event(s) occur. This is especially useful when the same function should be
triggered by multiple events. Only a single API endpoint is generated for all
events in the triggers list.
| Description | https://gradio.app/docs/gradio/on | Gradio - On Docs |
import gradio as gr
with gr.Blocks() as demo:
with gr.Row():
input = gr.Textbox()
button = gr.Button("Submit")
output = gr.Textbox()
gr.on(
triggers=[button.click, input.submit],
fn=lambda x: x,
inputs=[input],
outp... | Example Usage | https://gradio.app/docs/gradio/on | Gradio - On Docs |
Parameters ▼
triggers: list[Trigger] | Trigger | None
default `= None`
List of triggers to listen to, e.g. [btn.click, number.change]. If None, will
run on app load and changes to any inputs.
fn: Callable[..., Any] | None | Literal['decorator']
default `= "decorator"`
the function to... | Initialization | https://gradio.app/docs/gradio/on | Gradio - On Docs |
lt), the name of the function will be used as the API
endpoint.
api_description: str | None | Literal[False]
default `= None`
scroll_to_output: bool
default `= False`
If True, will scroll to output component on completion
show_progress: Literal['full', 'minimal', 'hidd... | Initialization | https://gradio.app/docs/gradio/on | Gradio - On Docs |
re running '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... | Initialization | https://gradio.app/docs/gradio/on | Gradio - On Docs |
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.
time_limit: int | None
default `= None`
The time limit for the function to run. Parameter on... | Initialization | https://gradio.app/docs/gradio/on | Gradio - On Docs |
Creates a "Sign In" button that redirects the user to sign in with Hugging
Face OAuth. Once the user is signed in, the button will act as a logout
button, and you can retrieve a signed-in user's profile by adding a parameter
of type `gr.OAuthProfile` to any Gradio function. This will only work if this
Gradio app is run... | Description | https://gradio.app/docs/gradio/loginbutton | Gradio - Loginbutton Docs |
**Using LoginButton as an input component.**
How LoginButton 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/loginbutton | Gradio - Loginbutton Docs |
Parameters ▼
value: str
default `= "Sign in with Hugging Face"`
logout_value: str
default `= "Logout ({})"`
The text to display when the user is signed in. The string should contain a
placeholder for the username with a call-to-action to logout, e.g. "Logout
({})".
eve... | Initialization | https://gradio.app/docs/gradio/loginbutton | Gradio - Loginbutton Docs |
Shortcuts
gradio.LoginButton
Interface String Shortcut `"loginbutton"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/loginbutton | Gradio - Loginbutton Docs |
login_with_huggingface
| Demos | https://gradio.app/docs/gradio/loginbutton | Gradio - Loginbutton 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 LoginButton component supports the foll... | Event Listeners | https://gradio.app/docs/gradio/loginbutton | Gradio - Loginbutton Docs |
api_name: str | None
default `= None`
defines how the endpoint appears in the API docs. Can be a string or None. If
set to a string, the endpoint will be exposed in the API docs with the given
name. If None (default), the name of the function will be used as the API
endpoint.
api_descr... | Event Listeners | https://gradio.app/docs/gradio/loginbutton | Gradio - Loginbutton Docs |
for each parameter. The lists should be
of equal length (and be up to length `max_batch_size`). The function is then
*required* to return a tuple of lists (even if there is only 1 output
component), with each list in the tuple corresponding to one output component.
max_batch_size: int
default `= 4`
Ma... | Event Listeners | https://gradio.app/docs/gradio/loginbutton | Gradio - Loginbutton Docs |
guments for js
method are values of 'inputs' and 'outputs', return should be a list of values
for output components.
concurrency_limit: int | None | Literal['default']
default `= "default"`
If set, this is the maximum number of this event that can be running
simultaneously. Can be set to None to mean ... | Event Listeners | https://gradio.app/docs/gradio/loginbutton | Gradio - Loginbutton Docs |
l 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.
[Sharing Your App](../../guides/sharing-your-app/)
| Event Listeners | https://gradio.app/docs/gradio/loginbutton | Gradio - Loginbutton Docs |
A Gradio request object that can be used to access the request headers,
cookies, query parameters and other information about the request from within
the prediction function. The class is a thin wrapper around the
fastapi.Request class. Attributes of this class include: `headers`, `client`,
`query_params`, `session_has... | Description | https://gradio.app/docs/gradio/request | Gradio - Request Docs |
import gradio as gr
def echo(text, request: gr.Request):
if request:
print("Request headers dictionary:", request.headers)
print("IP address:", request.client.host)
print("Query parameters:", dict(request.query_params))
print("Session hash:", request.session_h... | Example Usage | https://gradio.app/docs/gradio/request | Gradio - Request Docs |
Parameters ▼
request: fastapi.Request | None
default `= None`
A fastapi.Request
username: str | None
default `= None`
The username of the logged in user (if auth is enabled)
session_hash: str | None
default `= None`
The session hash of the current session. It is uni... | Initialization | https://gradio.app/docs/gradio/request | Gradio - Request Docs |
request_ip_headers
| Demos | https://gradio.app/docs/gradio/request | Gradio - Request Docs |
Creates a bar plot component to display data from a pandas DataFrame.
| Description | https://gradio.app/docs/gradio/barplot | Gradio - Barplot Docs |
**Using BarPlot as an input component.**
How BarPlot will pass its value to your function:
Type: `PlotData | None`
The data to display in a line plot.
Example Code
import gradio as gr
def predict(
value: PlotData | None
):
process value from t... | Behavior | https://gradio.app/docs/gradio/barplot | Gradio - Barplot Docs |
Parameters ▼
value: pd.DataFrame | Callable | None
default `= None`
The pandas dataframe containing the data to display in the plot.
x: str | None
default `= None`
Column corresponding to the x axis. Column can be numeric, datetime, or
string/category.
y: str | None
... | Initialization | https://gradio.app/docs/gradio/barplot | Gradio - Barplot Docs |
ne`
List containing column names of the series to show in the legend. By default,
all series are shown.
x_lim: list[float | None] | None
default `= None`
A tuple or list containing the limits for the x-axis, specified as [x_min,
x_max]. To fix only one of these values, set the other to None, e.g. [0,... | Initialization | https://gradio.app/docs/gradio/barplot | Gradio - Barplot Docs |
", "-x", "-y", or list of strings that represent the order of the
categories.
tooltip: Literal['axis', 'none', 'all'] | list[str]
default `= "axis"`
The tooltip to display when hovering on a point. "axis" shows the values for
the axis columns, "all" shows all column values, and "none" shows no tooltip... | Initialization | https://gradio.app/docs/gradio/barplot | Gradio - Barplot Docs |
uts: Component | list[Component] | Set[Component] | None
default `= None`
Components that are used as inputs to calculate `value` if `value` is a
function (has no effect otherwise). `value` is recalculated any time the
inputs change.
visible: bool | Literal['hidden']
default `= True`
Whether the plo... | Initialization | https://gradio.app/docs/gradio/barplot | Gradio - Barplot Docs |
-render.
preserved_by_key: list[str] | str | None
default `= "value"`
A list of parameters from this component's constructor. Inside a gr.render()
function, if a component is re-rendered with the same key, these (and only
these) parameters will be preserved in the UI (if they have been changed by
the ... | Initialization | https://gradio.app/docs/gradio/barplot | Gradio - Barplot Docs |
`gr.LinePlot`, `gr.ScatterPlot`, and `gr.BarPlot` all share the same API. Here
is a summary of the most important features. For full details and live demos,
see the [Creating Plots](/guides/creating-plots) and [Time
Plots](/guides/time-plots) guides.
**Basic Usage with a DataFrame**
Pass a `pd.DataFrame` as the value... | Key Concepts | https://gradio.app/docs/gradio/barplot | Gradio - Barplot Docs |
ection: gr.SelectData):
return gr.BarPlot(x_lim=[selection.index[0], selection.index[1]])
plot.double_click(lambda: gr.BarPlot(x_lim=None), outputs=plot)
**Realtime Data**
Use `gr.Timer` to keep plots updated with live data. You can attach the timer
via `every`, or wire it up manually:
... | Key Concepts | https://gradio.app/docs/gradio/barplot | Gradio - Barplot Docs |
Shortcuts
gradio.BarPlot
Interface String Shortcut `"barplot"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/barplot | Gradio - Barplot Docs |
bar_plot_demo
| Demos | https://gradio.app/docs/gradio/barplot | Gradio - Barplot 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 BarPlot component supports the followin... | Event Listeners | https://gradio.app/docs/gradio/barplot | Gradio - Barplot Docs |
nents to use as inputs. If the function takes no inputs,
this should be an empty list.
outputs: Component | BlockContext | list[Component | BlockContext] | Set[Component | BlockContext] | None
default `= None`
List of gradio.components to use as outputs. If the function returns no
outputs, this should... | Event Listeners | https://gradio.app/docs/gradio/barplot | Gradio - Barplot Docs |
queue, if the queue has been enabled.
If False, will not put this event on the queue, even if the queue has been
enabled. If None, will use the queue setting of the gradio app.
batch: bool
default `= False`
If True, then the function should process a batch of inputs, meaning that it
should accept a li... | Event Listeners | https://gradio.app/docs/gradio/barplot | Gradio - Barplot Docs |
. If set to "multiple", unlimited
submissions are allowed while pending, and "always_last" (default for
`.change()` and `.key_up()` events) would allow a second submission after the
pending event is complete.
js: str | Literal[True] | None
default `= None`
Optional frontend js method to run before run... | Event Listeners | https://gradio.app/docs/gradio/barplot | Gradio - Barplot Docs |
ender(). 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 only if it
complet... | Event Listeners | https://gradio.app/docs/gradio/barplot | Gradio - Barplot 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 |
A base class for defining methods that all input/output components should
have.
| Description | https://gradio.app/docs/gradio/state | Gradio - State Docs |
**Using State as an input component.**
How State will pass its value to your function:
Type: `Any`
Passes a value of arbitrary type through.
Example Code
import gradio as gr
def predict(
value: Any
):
process value from the State component
... | Behavior | https://gradio.app/docs/gradio/state | Gradio - State Docs |
Parameters ▼
value: Any
default `= None`
the initial value (of arbitrary type) of the state. The provided argument is
deepcopied. If a callable is provided, the function will be called whenever
the app loads to set the initial value of the state.
render: bool
default `= True`
should ... | Initialization | https://gradio.app/docs/gradio/state | Gradio - State 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 State component supports the following ... | Event Listeners | https://gradio.app/docs/gradio/state | Gradio - State Docs |
e API docs. Can be a string or None. If
set to a string, the endpoint will be exposed in the API docs with the given
name. If None (default), the name of the function will be used as the API
endpoint.
api_description: str | None | Literal[False]
default `= None`
Description of the API endpoint. Can be... | Event Listeners | https://gradio.app/docs/gradio/state | Gradio - State Docs |
. The function is then
*required* to return a tuple of lists (even if there is only 1 output
component), with each list in the tuple corresponding to one output component.
max_batch_size: int
default `= 4`
Maximum number of inputs to batch together if this is called from the queue
(only relevant if ba... | Event Listeners | https://gradio.app/docs/gradio/state | Gradio - State Docs |
for output components.
concurrency_limit: int | None | Literal['default']
default `= "default"`
If set, this is the maximum number of this event that can be running
simultaneously. Can be set to None to mean no concurrency_limit (any number of
this event can be running simultaneously). Set to "default... | Event Listeners | https://gradio.app/docs/gradio/state | Gradio - State Docs |
should return a
`gr.validate()` for each input value.
| Event Listeners | https://gradio.app/docs/gradio/state | Gradio - State Docs |
The gr.DeletedFileData class is a subclass of gr.EventData that
specifically carries information about the `.delete()` event. When
gr.DeletedFileData is added as a type hint to an argument of an event listener
method, a gr.DeletedFileData object will automatically be passed as the value
of that argument. The attributes... | Description | https://gradio.app/docs/gradio/deletedfiledata | Gradio - Deletedfiledata Docs |
import gradio as gr
def test(delete_data: gr.DeletedFileData):
return delete_data.file.path
with gr.Blocks() as demo:
files = gr.File(file_count="multiple")
deleted_file = gr.File()
files.delete(test, None, deleted_file)
demo.launch()
| Example Usage | https://gradio.app/docs/gradio/deletedfiledata | Gradio - Deletedfiledata Docs |
Parameters ▼
file: FileData
The file that was deleted, as a FileData object. The str path to the file can
be retrieved with the .path attribute.
| Attributes | https://gradio.app/docs/gradio/deletedfiledata | Gradio - Deletedfiledata Docs |
file_component_events
| Demos | https://gradio.app/docs/gradio/deletedfiledata | Gradio - Deletedfiledata Docs |
Creates a button that can be assigned arbitrary .click() events. The value
(label) of the button can be used as an input to the function (rarely used) or
set via the output of a function.
| Description | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
**Using Button as an input component.**
How Button will pass its value to your function:
Type: `str | None`
(Rarely used) the `str` corresponding to the button label when the button is
clicked
Example Code
import gradio as gr
def predict(
value: str | None
... | Behavior | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
Parameters ▼
value: str | I18nData | Callable
default `= "Run"`
default text for the button to display. If a function is provided, the
function will be called each time the app loads to set the initial value of
this component.
every: Timer | float | None
default `= None`
continuously... | Initialization | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
iteral['hidden']
default `= True`
If False, component will be hidden. If "hidden", component will be visually
hidden and not take up space in the layout but still exist in the DOM
interactive: bool
default `= True`
if False, the Button will be in a disabled state.
elem_id: str | None... | Initialization | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
scale applies in Rows, and to top-level Components
in Blocks where fill_height=True.
min_width: int | None
default `= None`
minimum pixel width, will wrap if not sufficient screen space to satisfy this
value. If a certain scale value results in this Component being narrower than
min_width, the min_wid... | Initialization | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
Shortcuts
gradio.Button
Interface String Shortcut `"button"`
Initialization Uses default values
gradio.ClearButton
Interface String Shortcut `"clearbutton"`
Initialization Uses default values
gradio.DeepLinkButton
Interface String Shortcut `"deeplinkbutton"`
Initializa... | Shortcuts | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
Description
Event listeners allow you to respond to user interactions with the UI
components you've defined in a Gradio Blocks app. When a user interacts with
an element, such as changing a slider value or uploading an image, a function
is called.
Supported Event Listeners
The Button component supports the following... | Event Listeners | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
api_name: str | None
default `= None`
defines how the endpoint appears in the API docs. Can be a string or None. If
set to a string, the endpoint will be exposed in the API docs with the given
name. If None (default), the name of the function will be used as the API
endpoint.
api_description: str | N... | Event Listeners | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
ter. The lists should be
of equal length (and be up to length `max_batch_size`). The function is then
*required* to return a tuple of lists (even if there is only 1 output
component), with each list in the tuple corresponding to one output component.
max_batch_size: int
default `= 4`
Maximum number of... | Event Listeners | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
method are values of 'inputs' and 'outputs', return should be a list of values
for output components.
concurrency_limit: int | None | Literal['default']
default `= "default"`
If set, this is the maximum number of this event that can be running
simultaneously. Can be set to None to mean no concurrency_... | Event Listeners | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
tion be called. The validator
receives the same inputs as the main function and should return a
`gr.validate()` for each input value.
| Event Listeners | https://gradio.app/docs/gradio/button | Gradio - Button Docs |
Used to render arbitrary Markdown output. Can also render latex enclosed by
dollar signs as well as code blocks with syntax highlighting. Supported
languages are bash, c, cpp, go, java, javascript, json, php, python, rust,
sql, and yaml. As this component does not accept user input, it is rarely used
as an input compon... | Description | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
**Using Markdown as an input component.**
How Markdown will pass its value to your function:
Type: `str | None`
Passes the `str` of Markdown corresponding to the displayed value.
Example Code
import gradio as gr
def predict(
value: str | None
):
... | Behavior | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
Parameters ▼
value: str | I18nData | Callable | None
default `= None`
Value to show in Markdown component. If a function is provided, the function
will be called each time the app loads to set the initial value of this
component.
label: str | I18nData | None
default `= None`
This par... | Initialization | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
None`
A list of dicts of the form {"left": open delimiter (str), "right": close
delimiter (str), "display": whether to display in newline (bool)} that will be
used to render LaTeX expressions. If not provided, `latex_delimiters` is set
to `[{ "left": "$$", "right": "$$", "display": True }]`, so only expressions
enclo... | Initialization | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
endered with the same key, these (and only
these) parameters will be preserved in the UI (if they have been changed by
the user or an event listener) instead of re-rendered based on the values
provided during constructor.
sanitize_html: bool
default `= True`
If False, will disable HTML sanitization wh... | Initialization | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
] | None
default `= None`
A list of buttons to show for the component. Currently, the only valid option
is "copy". The "copy" button allows the user to copy the text in the Markdown
component. By default, no buttons are shown.
container: bool
default `= False`
If True, the Markdown component will be... | Initialization | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
Shortcuts
gradio.Markdown
Interface String Shortcut `"markdown"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
blocks_helloblocks_kinematics
| Demos | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
Description
Event listeners allow you to respond to user interactions with the UI
components you've defined in a Gradio Blocks app. When a user interacts with
an element, such as changing a slider value or uploading an image, a function
is called.
Supported Event Listeners
The Markdown component supports the followi... | Event Listeners | https://gradio.app/docs/gradio/markdown | Gradio - Markdown Docs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.