EllieKini/Herta
Audio-to-Audio โข Updated
text stringlengths 0 2k | heading1 stringlengths 3 79 | source_page_url stringclasses 188
values | source_page_title stringclasses 188
values |
|---|---|---|---|
Creates a checkbox that can be set to `True` or `False`. Can be used as an
input to pass a boolean value to a function or as an output to display a
boolean value.
| Description | https://gradio.app/docs/gradio/checkbox | Gradio - Checkbox Docs |
**Using Checkbox as an input component.**
How Checkbox will pass its value to your function:
Type: `bool | None`
Passes the status of the checkbox as a `bool`.
Example Code
import gradio as gr
def predict(
value: bool | None
):
process value f... | Behavior | https://gradio.app/docs/gradio/checkbox | Gradio - Checkbox Docs |
Parameters โผ
value: bool | Callable
default `= False`
if True, checked by default. 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`
the label for this checkbox, dis... | Initialization | https://gradio.app/docs/gradio/checkbox | Gradio - Checkbox Docs |
e results in this Component being narrower than
min_width, the min_width parameter will be respected first.
interactive: bool | None
default `= None`
if True, this checkbox can be checked; if False, checking will be disabled. If
not provided, this is inferred based on whether the component is used as ... | Initialization | https://gradio.app/docs/gradio/checkbox | Gradio - Checkbox Docs |
es
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/or label, and clicking them will trigger any .click() events
register... | Initialization | https://gradio.app/docs/gradio/checkbox | Gradio - Checkbox Docs |
Shortcuts
gradio.Checkbox
Interface String Shortcut `"checkbox"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/checkbox | Gradio - Checkbox Docs |
sentence_builderhello_world_3
| Demos | https://gradio.app/docs/gradio/checkbox | Gradio - Checkbox 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 Checkbox component supports the followi... | Event Listeners | https://gradio.app/docs/gradio/checkbox | Gradio - Checkbox Docs |
of gradio.components 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
outp... | Event Listeners | https://gradio.app/docs/gradio/checkbox | Gradio - Checkbox Docs |
request on the queue, if the queue has been enabled.
If False, will not put this event on the queue, even if the queue has been
enabled. If None, will use the queue setting of the gradio app.
batch: bool
default `= False`
If True, then the function should process a batch of inputs, meaning that it
sh... | Event Listeners | https://gradio.app/docs/gradio/checkbox | Gradio - Checkbox Docs |
event is pending. If set to "multiple", unlimited
submissions are allowed while pending, and "always_last" (default for
`.change()` and `.key_up()` events) would allow a second submission after the
pending event is complete.
js: str | Literal[True] | None
default `= None`
Optional frontend js method t... | Event Listeners | https://gradio.app/docs/gradio/checkbox | Gradio - Checkbox Docs |
be used in @gr.render(). If set, this
value identifies an event as identical across re-renders when the key is
identical.
validator: Callable | None
default `= None`
Optional validation function to run before the main function. If provided,
this function will be executed first with queue=False, and on... | Event Listeners | https://gradio.app/docs/gradio/checkbox | Gradio - Checkbox 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 |
Walkthrough is a layout element within Blocks that can contain multiple
"Step" Components, which can be used to create a step-by-step workflow.
| Description | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
with gr.Walkthrough(selected=1) as walkthrough:
with gr.Step("Step 1", id=1):
btn = gr.Button("go to Step 2")
btn.click(lambda: gr.Walkthrough(selected=2), outputs=walkthrough)
with gr.Step("Step 2", id=2):
txt = gr.Textbox("Welcome to Step 2")
| Example Usage | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
Parameters โผ
selected: int | None
default `= None`
The currently selected step. Must be a number corresponding to the step
number. Defaults to the first step.
visible: bool
default `= True`
If False, Walkthrough will be hidden.
elem_id: str | None
default `= None`
A... | Initialization | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
walkthrough
| Demos | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
Methods | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs | |
%20Copyright%202022%20Fonticons,%20Inc.... | change | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough 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.... | change | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
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
input component, and the function should return a single value or a tuple of
valu... | change | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
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 all
show_progress_on: Component | list[Component] | None
default `= N... | change | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
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 generators that are iterating) will be cancelled, but
functions that are currently running wil... | change | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
s 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). If fn is None,
api_visibility will automatically be set to "private".
... | change | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough 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.... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
rs โผ
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
input component, and the function should return a single value or a tuple o... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
gress 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 all
show_progress_on: Component | list[Component] | None
defaul... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
vents 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 generators that are iterating) will be cancelled, but
functions that are currently runni... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
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). If fn is None,
api_visibility will automatically be set to "private".
... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
tring that is assigned as the id of the <div> containing the
contents of the Step layout. The same string followed by "-button" is attached
to the Step button. Can be used for targeting CSS styles.
elem_classes: list[str] | str | None
default `= None`
An optional string or list of strings that are ass... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%20318... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
lable | 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
input component, and the function should return a single value or a tuple of
values, with each element ... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
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 all
show_progress_on: Component | list[Component] | None
default `= None`
Component or lis... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
stener 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 generators that are iterating) will be cancelled, but
functions that are currently running will be allowed to finish... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
blic"
(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). If fn is None,
api_visibility will automatically be set to "private".
time_limit: int | N... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | change | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough 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.... | change | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
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
input component, and the function should return a single value or a tuple of
valu... | change | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
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 all
show_progress_on: Component | list[Component] | None
default `= N... | change | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
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 generators that are iterating) will be cancelled, but
functions that are currently running wil... | change | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
s 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). If fn is None,
api_visibility will automatically be set to "private".
... | change | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough 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.... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
rs โผ
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
input component, and the function should return a single value or a tuple o... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
gress 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 all
show_progress_on: Component | list[Component] | None
defaul... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
vents 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 generators that are iterating) will be cancelled, but
functions that are currently runni... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
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). If fn is None,
api_visibility will automatically be set to "private".
... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
%20Copyright%202022%20Fonticons,%20Inc.... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%20318... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
lable | 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
input component, and the function should return a single value or a tuple of
values, with each element ... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
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 all
show_progress_on: Component | list[Component] | None
default `= None`
Component or lis... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
stener 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 generators that are iterating) will be cancelled, but
functions that are currently running will be allowed to finish... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough Docs |
blic"
(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). If fn is None,
api_visibility will automatically be set to "private".
time_limit: int | N... | select | https://gradio.app/docs/gradio/walkthrough | Gradio - Walkthrough 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 |
Button that clears the value of a component or a list of components when
clicked. It is instantiated with the list of components to clear.
| Description | https://gradio.app/docs/gradio/clearbutton | Gradio - Clearbutton Docs |
**Using ClearButton as an input component.**
How ClearButton will pass its value to your function:
Type: `str | None`
(Rarely used) the `str` corresponding to the button label when the button is
clicked
Example Code
import gradio as gr
def predict(
value: str | N... | Behavior | https://gradio.app/docs/gradio/clearbutton | Gradio - Clearbutton Docs |
Parameters โผ
components: None | list[Component] | Component
default `= None`
value: str
default `= "Clear"`
default text for the button to display. If a function is provided, the
function will be called each time the app loads to set the initial value of
this component.
... | Initialization | https://gradio.app/docs/gradio/clearbutton | Gradio - Clearbutton Docs |
ent will be visually
hidden and not take up space in the layout but still exist in the DOM
interactive: bool
default `= True`
if False, the Button will be in a disabled state.
elem_id: str | None
default `= None`
an optional string that is assigned as the id of this component in the ... | Initialization | https://gradio.app/docs/gradio/clearbutton | Gradio - Clearbutton Docs |
min_width: int | None
default `= None`
minimum pixel width, will wrap if not sufficient screen space to satisfy this
value. If a certain scale value results in this Component being narrower than
min_width, the min_width parameter will be respected first.
api_name: str | None
default `= None... | Initialization | https://gradio.app/docs/gradio/clearbutton | Gradio - Clearbutton Docs |
Shortcuts
gradio.ClearButton
Interface String Shortcut `"clearbutton"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/clearbutton | Gradio - Clearbutton Docs |
Description
Event listeners allow you to respond to user interactions with the UI
components you've defined in a Gradio Blocks app. When a user interacts with
an element, such as changing a slider value or uploading an image, a function
is called.
Supported Event Listeners
The ClearButton component supports the foll... | Event Listeners | https://gradio.app/docs/gradio/clearbutton | Gradio - Clearbutton Docs |
The render decorator allows Gradio Blocks apps to have dynamic layouts, so
that the components and event listeners in your app can change depending on
custom logic. Attaching a @gr.render decorator to a function will cause the
function to be re-run whenever the inputs are changed (or specified triggers
are activated). ... | Description | https://gradio.app/docs/gradio/render | Gradio - Render Docs |
import gradio as gr
with gr.Blocks() as demo:
textbox = gr.Textbox(label="Enter text")
@gr.render(inputs=textbox)
def show_message(text):
if not text:
gr.Markdown("Please enter some text.")
else:
gr.Markdown(f"You entered: {te... | Example Usage | https://gradio.app/docs/gradio/render | Gradio - Render Docs |
Parameters โผ
inputs: list[Component] | Component | None
default `= None`
List of gradio.components to use as inputs. If the function takes no inputs,
this should be an empty list.
triggers: list[Trigger] | Trigger | None
default `= None`
List of triggers to listen to, e.g. [btn.click... | Initialization | https://gradio.app/docs/gradio/render | Gradio - Render Docs |
The gr.LikeData class is a subclass of gr.EventData that specifically
carries information about the `.like()` event. When gr.LikeData is added as a
type hint to an argument of an event listener method, a gr.LikeData object
will automatically be passed as the value of that argument. The attributes of
this object contain... | Description | https://gradio.app/docs/gradio/likedata | Gradio - Likedata Docs |
import gradio as gr
def test(value, like_data: gr.LikeData):
return {
"chatbot_value": value,
"liked_message": like_data.value,
"liked_index": like_data.index,
"liked_or_disliked_as_bool": like_data.liked
}
with gr.Blocks() as demo:
... | Example Usage | https://gradio.app/docs/gradio/likedata | Gradio - Likedata Docs |
Parameters โผ
index: int | tuple[int, int]
The index of the liked/disliked item. Is a tuple if the component is two
dimensional.
value: Any
The value of the liked/disliked item.
liked: bool
True if the item was liked, False if disliked, or string value if any other
feed... | Attributes | https://gradio.app/docs/gradio/likedata | Gradio - Likedata Docs |
chatbot_core_components_simple
[Chatbot Specific Events](../../guides/chatbot-specific-events/)
| Demos | https://gradio.app/docs/gradio/likedata | Gradio - Likedata Docs |
Creates a numeric field for user to enter numbers as input or display
numeric output.
| Description | https://gradio.app/docs/gradio/number | Gradio - Number Docs |
**Using Number as an input component.**
How Number will pass its value to your function:
Type: `float | int | None`
Passes field value as a `float` or `int` into the function, depending on
`precision`.
Example Code
import gradio as gr
def predict(
value: float | ... | Behavior | https://gradio.app/docs/gradio/number | Gradio - Number Docs |
Parameters โผ
value: float | Callable | None
default `= None`
default value. If None, the component will be empty and show the `placeholder`
if is set. If no `placeholder` is set, the component will show 0. If a
function is provided, the function will be called each time the app loads to
set the initia... | Initialization | https://gradio.app/docs/gradio/number | Gradio - Number Docs |
`
relative size compared to adjacent Components. For example if Components A and
B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide
as B. Should be an integer. scale applies in Rows, and to top-level Components
in Blocks where fill_height=True.
min_width: int
default `= 160`... | Initialization | https://gradio.app/docs/gradio/number | Gradio - Number Docs |
key'
are not reset across a re-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 ... | Initialization | https://gradio.app/docs/gradio/number | Gradio - Number Docs |
Shortcuts
gradio.Number
Interface String Shortcut `"number"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/number | Gradio - Number Docs |
tax_calculatorblocks_simple_squares
| Demos | https://gradio.app/docs/gradio/number | Gradio - Number 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 Number component supports the following... | Event Listeners | https://gradio.app/docs/gradio/number | Gradio - Number Docs |
io.components 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, thi... | Event Listeners | https://gradio.app/docs/gradio/number | Gradio - Number Docs |
on the queue, if the queue has been enabled.
If False, will not put this event on the queue, even if the queue has been
enabled. If None, will use the queue setting of the gradio app.
batch: bool
default `= False`
If True, then the function should process a batch of inputs, meaning that it
should acc... | Event Listeners | https://gradio.app/docs/gradio/number | Gradio - Number Docs |
pending. If set to "multiple", unlimited
submissions are allowed while pending, and "always_last" (default for
`.change()` and `.key_up()` events) would allow a second submission after the
pending event is complete.
js: str | Literal[True] | None
default `= None`
Optional frontend js method to run be... | Event Listeners | https://gradio.app/docs/gradio/number | Gradio - Number Docs |
in @gr.render(). If set, this
value identifies an event as identical across re-renders when the key is
identical.
validator: Callable | None
default `= None`
Optional validation function to run before the main function. If provided,
this function will be executed first with queue=False, and only if it... | Event Listeners | https://gradio.app/docs/gradio/number | Gradio - Number Docs |
Creates a textarea for user to enter string input or display string output.
| Description | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
**Using Textbox as an input component.**
How Textbox will pass its value to your function:
Type: `str | None`
Passes text value as a `str` into the function.
Example Code
import gradio as gr
def predict(
value: str | None
):
process value from... | Behavior | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
Parameters โผ
value: str | I18nData | Callable | None
default `= None`
text to show in textbox. If a function is provided, the function will be
called each time the app loads to set the initial value of this component.
type: Literal['text', 'password', 'email']
default `= "text"`
The ... | Initialization | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
regular interval for the reset Timer.
inputs: Component | list[Component] | set[Component] | None
default `= None`
components that are used as inputs to calculate `value` if `value` is a
function (has no effect otherwise). `value` is recalculated any time the
inputs change.
show_label... | Initialization | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
argeting CSS styles.
autofocus: bool
default `= False`
If True, will focus on the textbox when the page loads. Use this carefully, as
it can cause usability issues for sighted and non-sighted users.
autoscroll: bool
default `= True`
If True, will automatically scroll to the bottom of... | Initialization | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
rue. Can only be changed if `type` is "text".
rtl: bool
default `= False`
If True and `type` is "text", sets the direction of the text to right-to-left
(cursor appears on the left of the text). Default is False, which renders
cursor on the right.
buttons: list[Literal['copy'] | Button]... | Initialization | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
InputHTMLAttributes(autocorrect="off", spellcheck=False) to disable
autocorrect and spellcheck.
| Initialization | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
Shortcuts
gradio.Textbox
Interface String Shortcut `"textbox"`
Initialization Uses default values
gradio.TextArea
Interface String Shortcut `"textarea"`
Initialization Uses lines=7
| Shortcuts | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
Multi-line text input
By default, `gr.Textbox` renders as a single-line input. For longer text such
as paragraphs or code, set `lines` to show multiple rows and optionally
`max_lines` to cap the height:
import gradio as gr
def summarize(text):
return f"Received {len(text.split())} words... | Common Patterns | https://gradio.app/docs/gradio/textbox | Gradio - Textbox Docs |
No dataset card yet