text
stringlengths
0
2k
heading1
stringlengths
3
79
source_page_url
stringclasses
189 values
source_page_title
stringclasses
189 values
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
Tab (or its alias TabItem) is a layout element. Components defined within the Tab will be visible when this tab is selected tab.
Description
https://gradio.app/docs/gradio/tab
Gradio - Tab Docs
with gr.Blocks() as demo: with gr.Tab("Lion"): gr.Image("lion.jpg") gr.Button("New Lion") with gr.Tab("Tiger"): gr.Image("tiger.jpg") gr.Button("New Tiger")
Example Usage
https://gradio.app/docs/gradio/tab
Gradio - Tab Docs
Parameters ▼ label: str | I18nData | None default `= None` The visual label for the tab visible: bool | Literal['hidden'] default `= True` If False, Tab will be hidden. interactive: bool default `= True` If False, Tab will not be clickable. id: int |...
Initialization
https://gradio.app/docs/gradio/tab
Gradio - Tab Docs
Methods
https://gradio.app/docs/gradio/tab
Gradio - Tab Docs
![](data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='%23808080'%20viewBox='0%200%20640%20512'%3e%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....
select
https://gradio.app/docs/gradio/tab
Gradio - Tab 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/tab
Gradio - Tab Docs
le | 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 in ...
select
https://gradio.app/docs/gradio/tab
Gradio - Tab Docs
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 list o...
select
https://gradio.app/docs/gradio/tab
Gradio - Tab Docs
ner 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/tab
Gradio - Tab Docs
c" (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 | None...
select
https://gradio.app/docs/gradio/tab
Gradio - Tab Docs
![](data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='%23808080'%20viewBox='0%200%20640%20512'%3e%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....
select
https://gradio.app/docs/gradio/tab
Gradio - Tab 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/tab
Gradio - Tab Docs
le | 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 in ...
select
https://gradio.app/docs/gradio/tab
Gradio - Tab Docs
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 list o...
select
https://gradio.app/docs/gradio/tab
Gradio - Tab Docs
ner 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/tab
Gradio - Tab Docs
c" (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 | None...
select
https://gradio.app/docs/gradio/tab
Gradio - Tab Docs
When gr.EventData or one of its subclasses is added as a type hint to an argument of a prediction function, a gr.EventData object will automatically be passed as the value of that argument. The attributes of this object contains information about the event that triggered the listener. The gr.EventData object itself con...
Description
https://gradio.app/docs/gradio/eventdata
Gradio - Eventdata Docs
import gradio as gr with gr.Blocks() as demo: table = gr.Dataframe([[1, 2, 3], [4, 5, 6]]) gallery = gr.Gallery([("cat.jpg", "Cat"), ("dog.jpg", "Dog")]) textbox = gr.Textbox("Hello World!") statement = gr.Textbox() def on_select(value, evt: gr.EventData): ...
Example Usage
https://gradio.app/docs/gradio/eventdata
Gradio - Eventdata Docs
Parameters ▼ target: Block | None The component object that triggered the event. Can be used to distinguish multiple components bound to the same listener.
Attributes
https://gradio.app/docs/gradio/eventdata
Gradio - Eventdata Docs
gallery_selectionstictactoe [Blocks And Event Listeners](../../guides/blocks-and-event-listeners/)
Demos
https://gradio.app/docs/gradio/eventdata
Gradio - Eventdata 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
Creates a plot component to display various kinds of plots (matplotlib, plotly, altair, or bokeh plots are supported). As this component does not accept user input, it is rarely used as an input component.
Description
https://gradio.app/docs/gradio/plot
Gradio - Plot Docs
**Using Plot as an input component.** How Plot will pass its value to your function: Type: `PlotData | None` (Rarely used) passes the data displayed in the plot as an PlotData dataclass, which includes the plot information as a JSON string, as well as the type of chart and the plotting library. Example Code ...
Behavior
https://gradio.app/docs/gradio/plot
Gradio - Plot Docs
Parameters ▼ value: Any | None default `= None` Optionally, supply a default plot object to display, must be a matplotlib, plotly, altair, or bokeh figure, or a callable. 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/plot
Gradio - Plot Docs
to top-level Components in Blocks where fill_height=True. min_width: int default `= 160` 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 firs...
Initialization
https://gradio.app/docs/gradio/plot
Gradio - Plot Docs
g 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 registered on the button....
Initialization
https://gradio.app/docs/gradio/plot
Gradio - Plot Docs
Shortcuts gradio.Plot Interface String Shortcut `"plot"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/plot
Gradio - Plot Docs
blocks_kinematicsstock_forecast
Demos
https://gradio.app/docs/gradio/plot
Gradio - Plot 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 Plot component supports the following e...
Event Listeners
https://gradio.app/docs/gradio/plot
Gradio - Plot Docs
PI 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 a ...
Event Listeners
https://gradio.app/docs/gradio/plot
Gradio - Plot Docs
he 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 batch...
Event Listeners
https://gradio.app/docs/gradio/plot
Gradio - Plot Docs
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" t...
Event Listeners
https://gradio.app/docs/gradio/plot
Gradio - Plot Docs
ould return a `gr.validate()` for each input value. [Plot Component For Maps](../../guides/plot-component-for-maps/)
Event Listeners
https://gradio.app/docs/gradio/plot
Gradio - Plot Docs
Button that triggers a Spaces Duplication, when the demo is on Hugging Face Spaces. Does nothing locally.
Description
https://gradio.app/docs/gradio/duplicatebutton
Gradio - Duplicatebutton Docs
**Using DuplicateButton as an input component.** How DuplicateButton will pass its value to your function: Type: `str | None` (Rarely used) the `str` corresponding to the button label when the button is clicked Example Code import gradio as gr def predict( value:...
Behavior
https://gradio.app/docs/gradio/duplicatebutton
Gradio - Duplicatebutton Docs
Parameters ▼ value: str default `= "Duplicate Space"` default text for the button to display. If a function is provided, the function will be called each time the app loads to set the initial value of this component. every: Timer | float | None default `= None` continuously calls `va...
Initialization
https://gradio.app/docs/gradio/duplicatebutton
Gradio - Duplicatebutton Docs
he layout but still exist in the DOM interactive: bool default `= True` if False, the Button will be in a disabled state. elem_id: str | None default `= None` an optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles. ...
Initialization
https://gradio.app/docs/gradio/duplicatebutton
Gradio - Duplicatebutton Docs
m pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
Initialization
https://gradio.app/docs/gradio/duplicatebutton
Gradio - Duplicatebutton Docs
Shortcuts gradio.DuplicateButton Interface String Shortcut `"duplicatebutton"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/duplicatebutton
Gradio - Duplicatebutton Docs
Description Event listeners allow you to respond to user interactions with the UI components you've defined in a Gradio Blocks app. When a user interacts with an element, such as changing a slider value or uploading an image, a function is called. Supported Event Listeners The DuplicateButton component supports the ...
Event Listeners
https://gradio.app/docs/gradio/duplicatebutton
Gradio - Duplicatebutton Docs
empty list. api_name: str | None default `= None` defines how the endpoint appears in the API docs. Can be a string or None. If set to a string, the endpoint will be exposed in the API docs with the given name. If None (default), the name of the function will be used as the API endpoint. ...
Event Listeners
https://gradio.app/docs/gradio/duplicatebutton
Gradio - Duplicatebutton Docs
nput values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component. max_batch_size: int defau...
Event Listeners
https://gradio.app/docs/gradio/duplicatebutton
Gradio - Duplicatebutton Docs
n'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components. concurrency_limit: int | None | Literal['default'] default `= "default"` If set, this is the maximum number of this event that can be running simultaneously. Can be set to N...
Event Listeners
https://gradio.app/docs/gradio/duplicatebutton
Gradio - Duplicatebutton Docs
essfully will the main function be called. The validator receives the same inputs as the main function and should return a `gr.validate()` for each input value.
Event Listeners
https://gradio.app/docs/gradio/duplicatebutton
Gradio - Duplicatebutton 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
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
Creates a video component that can be used to upload/record videos (as an input) or display videos (as an output). For the video to be playable in the browser it must have a compatible container and codec combination. Allowed combinations are .mp4 with h264 codec, .ogg with theora codec, and .webm with vp9 codec. If th...
Description
https://gradio.app/docs/gradio/video
Gradio - Video Docs
**Using Video as an input component.** How Video will pass its value to your function: Type: `str | None` Passes the uploaded video as a `str` filepath or URL whose extension can be modified by `format`. Example Code import gradio as gr def predict( value: str | ...
Behavior
https://gradio.app/docs/gradio/video
Gradio - Video Docs
Parameters ▼ value: str | Path | Callable | None default `= None` path or URL for the default value that Video component is going to take. Or can be callable, in which case the function will be called whenever the app loads to set the initial value of the component. format: str | None ...
Initialization
https://gradio.app/docs/gradio/video
Gradio - Video Docs
nd used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to. every: Timer | float | None default `= None` continuously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a floa...
Initialization
https://gradio.app/docs/gradio/video
Gradio - Video Docs
be hidden. If "hidden", component will be visually hidden and not take up space in the layout but still exist in the DOM elem_id: str | None default `= None` an optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles. elem_clas...
Initialization
https://gradio.app/docs/gradio/video
Gradio - Video Docs
ult `= None` whether the component should record/retain the audio track for a video. By default, audio is excluded for webcam videos and included for uploaded videos. autoplay: bool default `= False` whether to automatically play the video when the component is used as an output. Note: browsers will ...
Initialization
https://gradio.app/docs/gradio/video
Gradio - Video Docs
d position on the video. Valid formats for the image are: jpeg, png. subtitles: str | Path | list[dict[str, Any]] | None default `= None` A subtitle file (srt, vtt, or json) for the video, or a list of subtitle dictionaries in the format [{"text": str, "timestamp": [start, end]}] where timestamps are ...
Initialization
https://gradio.app/docs/gradio/video
Gradio - Video Docs
Shortcuts gradio.Video Interface String Shortcut `"video"` Initialization Uses default values gradio.PlayableVideo Interface String Shortcut `"playablevideo"` Initialization Uses format="mp4"
Shortcuts
https://gradio.app/docs/gradio/video
Gradio - Video Docs
video_identity_2
Demos
https://gradio.app/docs/gradio/video
Gradio - Video Docs
Description Event listeners allow you to respond to user interactions with the UI components you've defined in a Gradio Blocks app. When a user interacts with an element, such as changing a slider value or uploading an image, a function is called. Supported Event Listeners The Video component supports the following ...
Event Listeners
https://gradio.app/docs/gradio/video
Gradio - Video Docs
d when the user changes the value of the Video. Event Parameters Parameters ▼ fn: Callable | None | Literal['decorator'] default `= "decorator"` the function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one ...
Event Listeners
https://gradio.app/docs/gradio/video
Gradio - Video Docs
s: Literal['full', 'minimal', 'hidden'] default `= "full"` how to show the progress animation while event is running: "full" shows a spinner which covers the output component area as well as a runtime display in the upper right corner, "minimal" only shows the runtime display, "hidden" shows no progress animation at ...
Event Listeners
https://gradio.app/docs/gradio/video
Gradio - Video Docs
ict[str, Any] | list[dict[str, Any]] | None default `= None` A list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generato...
Event Listeners
https://gradio.app/docs/gradio/video
Gradio - Video Docs
undocumented'] default `= "public"` controls the visibility and accessibility of this endpoint. Can be "public" (shown in API docs and callable by clients), "private" (hidden from API docs and not callable by the Gradio client libraries), or "undocumented" (hidden from API docs but callable by clients and via gr.load...
Event Listeners
https://gradio.app/docs/gradio/video
Gradio - Video Docs
Helper Classes
https://gradio.app/docs/gradio/video
Gradio - Video Docs
gradio.WebcamOptions(···) Description A dataclass for specifying options for the webcam tool in the ImageEditor component. An instance of this class can be passed to the `webcam_options` parameter of `gr.ImageEditor`. Initialization Parameters ▼ mirror: bool default `= True` If True, the webcam wi...
Webcam Options
https://gradio.app/docs/gradio/video
Gradio - Video Docs
Validates that the audio length is within the specified min and max length (in seconds). You can use this to construct a validator that will check if the user-provided audio is either too short or too long. import gradio as gr demo = gr.Interface( lambda x: x, inputs="video", ...
is_video_correct_length
https://gradio.app/docs/gradio/video
Gradio - Video Docs
Creates a 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
e` 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
The gr.RetryData class is a subclass of gr.Event data that specifically carries information about the `.retry()` event. When gr.RetryData is added as a type hint to an argument of an event listener method, a gr.RetryData object will automatically be passed as the value of that argument. The attributes of this object co...
Description
https://gradio.app/docs/gradio/retrydata
Gradio - Retrydata Docs
import gradio as gr def retry(retry_data: gr.RetryData, history: list[gr.MessageDict]): history_up_to_retry = history[:retry_data.index] new_response = "" for token in api.chat_completion(history): new_response += token yield history + [new_response] wit...
Example Usage
https://gradio.app/docs/gradio/retrydata
Gradio - Retrydata Docs
Parameters ▼ index: int | tuple[int, int] The index of the user message that should be retried. value: Any The value of the user message that should be retried. [Chatbot Specific Events](../../guides/chatbot-specific-events/)
Attributes
https://gradio.app/docs/gradio/retrydata
Gradio - Retrydata Docs
Component to select a date and (optionally) a time.
Description
https://gradio.app/docs/gradio/datetime
Gradio - Datetime Docs
**Using DateTime as an input component.** How DateTime will pass its value to your function: Type: `str | float | datetime | None` Passes text value as a `str` into the function. Example Code import gradio as gr def predict( value: str | float | datetime | None ...
Behavior
https://gradio.app/docs/gradio/datetime
Gradio - Datetime Docs
Parameters ▼ value: float | str | datetime | None default `= None` default value for datetime. include_time: bool default `= True` If True, the component will include time selection. If False, only date selection will be available. type: Literal['timestamp', 'datetime...
Initialization
https://gradio.app/docs/gradio/datetime
Gradio - Datetime Docs