text
stringlengths
0
2k
heading1
stringlengths
3
79
source_page_url
stringclasses
189 values
source_page_title
stringclasses
189 values
ing to one output component. inputs: Component | BlockContext | list[Component | BlockContext] | Set[Component | BlockContext] | None default `= None` List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list. outputs: Component | BlockCo...
Event Listeners
https://gradio.app/docs/gradio/colorpicker
Gradio - Colorpicker Docs
the progress animation on. If None, will show the progress animation on all of the output components. queue: bool default `= True` If True, will place the request 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, ...
Event Listeners
https://gradio.app/docs/gradio/colorpicker
Gradio - Colorpicker Docs
er_mode: Literal['once', 'multiple', 'always_last'] | None default `= None` If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` and `.key_up()`...
Event Listeners
https://gradio.app/docs/gradio/colorpicker
Gradio - Colorpicker Docs
stream_every: float default `= 0.5` key: int | str | tuple[int | str, ...] | None default `= None` A unique key for this event listener to be used in @gr.render(). If set, this value identifies an event as identical across re-renders when the key is identical. validator...
Event Listeners
https://gradio.app/docs/gradio/colorpicker
Gradio - Colorpicker 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
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
The gr.SelectData class is a subclass of gr.EventData that specifically carries information about the `.select()` event. When gr.SelectData is added as a type hint to an argument of an event listener method, a gr.SelectData object will automatically be passed as the value of that argument. The attributes of this object...
Description
https://gradio.app/docs/gradio/selectdata
Gradio - Selectdata 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(evt: gr.SelectData): ret...
Example Usage
https://gradio.app/docs/gradio/selectdata
Gradio - Selectdata Docs
Parameters ▼ index: int | tuple[int, int] The index of the selected item. Is a tuple if the component is two dimensional or selection is a range. value: Any The value of the selected item. row_value: list[float | str] The value of the entire row that the selected item ...
Attributes
https://gradio.app/docs/gradio/selectdata
Gradio - Selectdata Docs
gallery_selectionstictactoe
Demos
https://gradio.app/docs/gradio/selectdata
Gradio - Selectdata Docs
Creates a gallery component that allows displaying a grid of images or videos, and optionally captions. If used as an input, the user can upload images or videos to the gallery. If used as an output, the user can click on individual images or videos to view them at a higher resolution.
Description
https://gradio.app/docs/gradio/gallery
Gradio - Gallery Docs
**Using Gallery as an input component.** How Gallery will pass its value to your function: Type: `list[tuple[str, str | None]] | list[tuple[PIL.Image.Image, str | None]] | list[tuple[np.ndarray, str | None]] | None` Passes the list of images or videos as: * a list of (media, caption) tuples * a list of (media,...
Behavior
https://gradio.app/docs/gradio/gallery
Gradio - Gallery Docs
Parameters ▼ value: list[np.ndarray | PIL.Image.Image | str | Path | tuple] | Callable | None default `= None` List of images or videos to display in the gallery 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. ...
Initialization
https://gradio.app/docs/gradio/gallery
Gradio - Gallery Docs
e). `value` is recalculated any time the inputs change. show_label: bool | None default `= None` if True, will display label. container: bool default `= True` If True, will place the component in a container - providing some extra padding around the border. scale: int...
Initialization
https://gradio.app/docs/gradio/gallery
Gradio - Gallery Docs
with the same key across re-renders are treated as the same component, not a new component. Properties set in 'preserved_by_key' are not reset across a re-render. preserved_by_key: list[str] | str | None default `= "value"` A list of parameters from this component's constructor. Inside a gr.render() ...
Initialization
https://gradio.app/docs/gradio/gallery
Gradio - Gallery Docs
`= None` CSS object-fit property for the thumbnail images in the gallery. Can be "contain", "cover", "fill", "none", or "scale-down". buttons: list[Literal['share', 'download', 'download_all', 'fullscreen'] | Button] | None default `= None` A list of buttons to show in the top right corner of the co...
Initialization
https://gradio.app/docs/gradio/gallery
Gradio - Gallery Docs
sources: list[Literal['upload', 'webcam', 'clipboard']] | None default `= None` A list of sources that the user can upload images from when this component is used as an input. Valid options are "upload", "webcam", and "clipboard". "upload" allows the user to upload files from their computer, "webcam" allows the user...
Initialization
https://gradio.app/docs/gradio/gallery
Gradio - Gallery Docs
Shortcuts gradio.Gallery Interface String Shortcut `"gallery"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/gallery
Gradio - Gallery Docs
fake_gangif_maker
Demos
https://gradio.app/docs/gradio/gallery
Gradio - Gallery 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 Gallery component supports the followin...
Event Listeners
https://gradio.app/docs/gradio/gallery
Gradio - Gallery 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 values, with each e...
Event Listeners
https://gradio.app/docs/gradio/gallery
Gradio - Gallery Docs
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 `= None` Component...
Event Listeners
https://gradio.app/docs/gradio/gallery
Gradio - Gallery Docs
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 will be allowed to...
Event Listeners
https://gradio.app/docs/gradio/gallery
Gradio - Gallery Docs
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". time_limit: ...
Event Listeners
https://gradio.app/docs/gradio/gallery
Gradio - Gallery 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
![](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....
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
![](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/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
![](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/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
![](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....
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
![](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/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
![](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/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
Interface is Gradio's main high-level class, and allows you to create a web-based GUI / demo around a machine learning model (or any Python function) in a few lines of code. You must specify three parameters: (1) the function to create a GUI for (2) the desired input components and (3) the desired output components. Ad...
Description
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
import gradio as gr def image_classifier(inp): return {'cat': 0.3, 'dog': 0.7} demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label") demo.launch()
Example Usage
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
Parameters ▼ fn: Callable the function to wrap an interface around. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding t...
Initialization
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
If True, caches examples in the server for fast runtime in examples. If "lazy", then examples are cached (for all users of the app) after their first use (by any user of the app). If None, will use the GRADIO_CACHE_EXAMPLES environment variable, which should be either "true" or "false". In HuggingFace Spaces, this pa...
Initialization
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
tically rerun if any of the inputs change. title: str | I18nData | None default `= None` a title for the interface; if provided, appears above the input and output components in large font. Also used as the tab title when opened in a browser window. description: str | None default `= ...
Initialization
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
s ["X", "Y"], in which case the values will be the list of strings and the labels will ["Flag as X", "Flag as Y"], etc. flagging_dir: str default `= ".gradio/flagged"` path to the directory where flagged data is stored. If the directory does not exist, it will be created. flagging_call...
Initialization
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
None` defines how the prediction 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, the name of the function will be used. api_description: str | None | Literal[False] default `= None` Description ...
Initialization
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
an be provided as well to configure other properties of the container holding the additional inputs. Defaults to a `gr.Accordion(label="Additional Inputs", open=False)`. This parameter is only used if `additional_inputs` is provided. submit_btn: str | Button default `= "Submit"` the button to use for ...
Initialization
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
'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 all ...
Initialization
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
hello_worldhello_world_2hello_world_3
Demos
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
Methods
https://gradio.app/docs/gradio/interface
Gradio - Interface 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....
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
2'%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.%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%2...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
pp inline in an iframe. Defaults to True in python notebooks; False otherwise. inbrowser: bool default `= False` whether to automatically launch the gradio app in a new tab on the default browser. share: bool | None default `= None` whether to create a publicly shareable link for the...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
an alert modal and printed in the browser console log. They will also be displayed in the alert modal of downstream apps that gr.load() this app. server_name: str | None default `= None` to make app accessible on local network, set this to "0.0.0.0". Can be set by environment variable GRADIO_SERVER_NA...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
inks: list[Literal['api', 'gradio', 'settings', 'runs'] | dict[str, str]] | None default `= None` The links to display in the footer of the app. Accepts a list, where each element of the list must be one of "api", "gradio", "settings", or "runs" corresponding to the API docs, "built with Gradio", the settings page, a...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
of your app are not allowed to access). Must be absolute paths. Warning: takes precedence over `allowed_paths` and all other directories exposed by Gradio by default. Can be set by comma separated environment variable GRADIO_BLOCKED_PATHS. root_path: str | None default `= None` The root path (or "moun...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
protocol to use for the share links. Defaults to "https", unless a custom share_server_address is provided, in which case it defaults to "http". If you are using a custom share_server_address and want to use https, you must set this to "https". share_server_tls_certificate: str | None default `= None`...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
dio server running on localhost. If False, allows requests to localhost that originate from localhost but also, crucially, from "null". This parameter should normally be True to prevent CSRF attacks but may need to be False when embedding a *locally-running Gradio app* using web components. node_server_...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs