text
stringlengths
0
2k
heading1
stringlengths
3
79
source_page_url
stringclasses
189 values
source_page_title
stringclasses
189 values
wandb: ModuleType | None default `= None` If the wandb module is provided, will integrate with it and appear on WandB dashboard mlflow: ModuleType | None default `= None` If the mlflow module is provided, will integrate with the experiment and appear on ML Flow dashboard
integrate
https://gradio.app/docs/gradio/interface#interface-queue
Gradio - Interface#Interface Queue 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....
queue
https://gradio.app/docs/gradio/interface#interface-queue
Gradio - Interface#Interface Queue 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%2...
queue
https://gradio.app/docs/gradio/interface#interface-queue
Gradio - Interface#Interface Queue Docs
ro%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.3L391.3%20319.9C381%...
queue
https://gradio.app/docs/gradio/interface#interface-queue
Gradio - Interface#Interface Queue Docs
send status at regular intervals set by this parameter as the number of seconds. api_open: bool | None default `= None` If True, the REST routes of the backend will be open, allowing requests made directly to those endpoints to skip the queue. max_size: int | None default `= None` T...
queue
https://gradio.app/docs/gradio/interface#interface-queue
Gradio - Interface#Interface Queue Docs
This component displays a table of value spreadsheet-like component. Can be used to display data as an output component, or as an input to collect data from the user.
Description
https://gradio.app/docs/gradio/dataframe
Gradio - Dataframe Docs
**Using Dataframe as an input component.** How Dataframe will pass its value to your function: Type: `pd.DataFrame | np.ndarray | pl.DataFrame | list[list]` Passes the uploaded spreadsheet data as a `pandas.DataFrame`, `numpy.array`, `polars.DataFrame`, or native 2D Python `list[list]` depending on `type`. Example ...
Behavior
https://gradio.app/docs/gradio/dataframe
Gradio - Dataframe Docs
Parameters ▼ value: pd.DataFrame | Styler | np.ndarray | pl.DataFrame | list | list[list] | dict | str | Callable | None default `= None` Default value to display in the DataFrame. Supports pandas, numpy, polars, and list of lists. If a Styler is provided, it will be used to set the displayed value in...
Initialization
https://gradio.app/docs/gradio/dataframe
Gradio - Dataframe Docs
t can be created in the dataframe via the UI. If the first element is None, there is no minimum number of columns. If the second element is None, there is no maximum number of columns. Only applies if `interactive` is True. datatype: Literal['str', 'number', 'bool', 'date', 'markdown', 'html', 'image', ...
Initialization
https://gradio.app/docs/gradio/dataframe
Gradio - Dataframe Docs
e the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to. show_label: bool | None default `= None` if True, will display label. eve...
Initialization
https://gradio.app/docs/gradio/dataframe
Gradio - Dataframe Docs
e used to display data. If not provided, this is inferred based on whether the component is used as an input or output. visible: bool | Literal['hidden'] default `= True` If False, component will be hidden. If "hidden", component will be visually hidden and not take up space in the layout but still ex...
Initialization
https://gradio.app/docs/gradio/dataframe
Gradio - Dataframe Docs
and based on the cell contents and the table may need to be horizontally scrolled. If `column_width` is set, then any overflow text will be hidden. line_breaks: bool default `= True` If True (default), will enable Github-flavored Markdown line breaks in chatbot messages. If False, single new lines wil...
Initialization
https://gradio.app/docs/gradio/dataframe
Gradio - Dataframe Docs
pinned_columns: int | None default `= None` If provided, will pin the specified number of columns from the left. static_columns: list[int] | None default `= None` List of column indices (int) that should not be editable. Only applies when interactive=True. When specified, col_count is au...
Initialization
https://gradio.app/docs/gradio/dataframe
Gradio - Dataframe Docs
Shortcuts gradio.Dataframe Interface String Shortcut `"dataframe"` Initialization Uses default values gradio.Numpy Interface String Shortcut `"numpy"` Initialization Uses type="numpy" gradio.Matrix Interface String Shortcut `"matrix"` Initialization Uses type="array" ...
Shortcuts
https://gradio.app/docs/gradio/dataframe
Gradio - Dataframe Docs
filter_recordsmatrix_transposetax_calculatorsort_records
Demos
https://gradio.app/docs/gradio/dataframe
Gradio - Dataframe 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 Dataframe component supports the follow...
Event Listeners
https://gradio.app/docs/gradio/dataframe
Gradio - Dataframe Docs
nent. 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 | BlockContext | list[Component ...
Event Listeners
https://gradio.app/docs/gradio/dataframe
Gradio - Dataframe Docs
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, will use the queue sett...
Event Listeners
https://gradio.app/docs/gradio/dataframe
Gradio - Dataframe Docs
, '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()` events) would allow a ...
Event Listeners
https://gradio.app/docs/gradio/dataframe
Gradio - Dataframe Docs
very: 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: Callable | None defa...
Event Listeners
https://gradio.app/docs/gradio/dataframe
Gradio - Dataframe Docs
Creates an image component that can be used to upload images (as an input) or display images (as an output).
Description
https://gradio.app/docs/gradio/imageslider
Gradio - Imageslider Docs
**Using ImageSlider as an input component.** How ImageSlider will pass its value to your function: Type: `image_tuple | None` Passes the uploaded image as a tuple of `numpy.array`, `PIL.Image` or `str` filepath depending on `type`. Example Code import gradio as gr def predic...
Behavior
https://gradio.app/docs/gradio/imageslider
Gradio - Imageslider Docs
Parameters ▼ value: image_tuple | Callable | None default `= None` A tuple of PIL Image, numpy array, path or URL for the default value that ImageSlider component is going to take, this pair of images should be of equal size. If a function is provided, the function will be called each time the app loa...
Initialization
https://gradio.app/docs/gradio/imageslider
Gradio - Imageslider Docs
image_mode will be inferred from the image file types (e.g. "RGBA" for a .png image, "RGB" in most other cases). type: Literal['numpy', 'pil', 'filepath'] default `= "numpy"` The format the images are converted to before being passed into the prediction function. "numpy" converts the images to numpy a...
Initialization
https://gradio.app/docs/gradio/imageslider
Gradio - Imageslider Docs
nce. The "download" button allows the user to download the image. The "fullscreen" button allows the user to view the image in fullscreen mode. Custom gr.Button() instances will appear in the toolbar with their configured icon and/or label, and clicking them will trigger any .click() events registered on the button. by...
Initialization
https://gradio.app/docs/gradio/imageslider
Gradio - Imageslider Docs
None default `= None` An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles. render: bool default `= True` If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assi...
Initialization
https://gradio.app/docs/gradio/imageslider
Gradio - Imageslider Docs
Shortcuts gradio.ImageSlider Interface String Shortcut `"imageslider"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/imageslider
Gradio - Imageslider Docs
imageslider
Demos
https://gradio.app/docs/gradio/imageslider
Gradio - Imageslider Docs
Description Event listeners allow you to respond to user interactions with the UI components you've defined in a Gradio Blocks app. When a user interacts with an element, such as changing a slider value or uploading an image, a function is called. Supported Event Listeners The ImageSlider component supports the foll...
Event Listeners
https://gradio.app/docs/gradio/imageslider
Gradio - Imageslider Docs
red. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component. inputs: Component | BlockContext | list[...
Event Listeners
https://gradio.app/docs/gradio/imageslider
Gradio - Imageslider Docs
e upper right corner, "minimal" only shows the runtime display, "hidden" shows no progress animation at all show_progress_on: Component | list[Component] | None default `= None` Component or list of components to show the progress animation on. If None, will show the progress animation on all of the o...
Event Listeners
https://gradio.app/docs/gradio/imageslider
Gradio - Imageslider Docs
nt is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish. trigger_mode: Literal['once', 'multiple', 'always_last'] | None default `= None` If "onc...
Event Listeners
https://gradio.app/docs/gradio/imageslider
Gradio - Imageslider Docs
radio client libraries), or "undocumented" (hidden from API docs but callable by clients and via gr.load). If fn is None, api_visibility will automatically be set to "private". time_limit: int | None default `= None` stream_every: float default `= 0.5` key: int | str | ...
Event Listeners
https://gradio.app/docs/gradio/imageslider
Gradio - Imageslider Docs
Creates a file explorer component that allows users to browse files on the machine hosting the Gradio app. As an input component, it also allows users to select files to be used as input to a function, while as an output component, it displays selected files.
Description
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
**Using FileExplorer as an input component.** How FileExplorer will pass its value to your function: Type: `list[str] | str | None` Passes the selected file or directory as a `str` path (relative to `root`) or `list[str}` depending on `file_count` Example Code import gradio as gr ...
Behavior
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
Parameters ▼ glob: str default `= "**/*"` The glob-style pattern used to select which files to display, e.g. "*" to match all files, "*.png" to match all .png files, "**/*.txt" to match any .txt file in any subdirectory, etc. The default value matches all files and folders recursively. See the Python ...
Initialization
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
onent. If None and 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 `v...
Initialization
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
min_height: int | str | None default `= None` interactive: bool | None default `= None` if True, will allow users to select file(s); if False, will only display files. If not provided, this is inferred based on whether the component is used as an input or output. visi...
Initialization
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
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/fileexplorer
Gradio - Fileexplorer Docs
Shortcuts gradio.FileExplorer Interface String Shortcut `"fileexplorer"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer 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 FileExplorer component supports the fol...
Event Listeners
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
text] | 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 | BlockContext | list[Component | BlockContext] | Set[Component | BlockContext] | None default `= None` List of gradio.components to use as outp...
Event Listeners
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
lt `= 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, will use the queue setting of the gradio app. batch: bool default `= False` If True, then the function should process a...
Event Listeners
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
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()` events) would allow a second submission after the pending event is complete. js: str | Literal[True] | None default `= ...
Event Listeners
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
ique 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: Callable | None default `= None` Optional validation function to run before the main function. If provided, this function will be exe...
Event Listeners
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
Creates a navigation bar component for multipage Gradio apps. The navbar component allows customizing the appearance of the navbar for that page. Only one Navbar component can exist per page in a Blocks app, and it can be placed anywhere within the page. The Navbar component is designed to control the appearance of t...
Description
https://gradio.app/docs/gradio/navbar
Gradio - Navbar Docs
**Using Navbar as an input component.** How Navbar will pass its value to your function: Type: `list[tuple[str, str]] | None` The preprocessed input data sent to the user's function in the backend. Example Code import gradio as gr def predict( value: list[tuple[s...
Behavior
https://gradio.app/docs/gradio/navbar
Gradio - Navbar Docs
Parameters ▼ value: list[tuple[str, str]] | None default `= None` If a list of tuples of (page_name, page_path) are provided, these additional pages will be added to the navbar alongside the existing pages defined in the Blocks app. The page_path can be either a relative path for internal Gradio app p...
Initialization
https://gradio.app/docs/gradio/navbar
Gradio - Navbar Docs
Shortcuts gradio.Navbar Interface String Shortcut `"navbar"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/navbar
Gradio - Navbar 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 Navbar component supports the following...
Event Listeners
https://gradio.app/docs/gradio/navbar
Gradio - Navbar Docs
the API docs. Can be a string or None. If set to a string, the endpoint will be exposed in the API docs with the given name. If None (default), the name of the function will be used as the API endpoint. api_description: str | None | Literal[False] default `= None` Description of the API endpoint. Can...
Event Listeners
https://gradio.app/docs/gradio/navbar
Gradio - Navbar Docs
e`). 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...
Event Listeners
https://gradio.app/docs/gradio/navbar
Gradio - Navbar Docs
es 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 "defa...
Event Listeners
https://gradio.app/docs/gradio/navbar
Gradio - Navbar Docs
and should return a `gr.validate()` for each input value. [Multipage Apps](../../guides/multipage-apps/)
Event Listeners
https://gradio.app/docs/gradio/navbar
Gradio - Navbar Docs
Set the static paths to be served by the gradio app. Static files are are served directly from the file system instead of being copied. They are served to users with The Content-Disposition HTTP header set to "inline" when sending these files to users. This indicates that the file should be displayed directly in the ...
Description
https://gradio.app/docs/gradio/set_static_paths
Gradio - Set_Static_Paths Docs
import gradio as gr Paths can be a list of strings or pathlib.Path objects corresponding to filenames or directories. gr.set_static_paths(paths=["test/test_files/"]) The example files and the default value of the input will not be copied to the gradio cache and will be served directly. ...
Example Usage
https://gradio.app/docs/gradio/set_static_paths
Gradio - Set_Static_Paths Docs
Parameters ▼ paths: str | pathlib.Path | list[str | pathlib.Path] filepath or list of filepaths or directory names to be served by the gradio app. If it is a directory name, ALL files located within that directory will be considered static and not moved to the gradio cache. This also means that ALL fil...
Initialization
https://gradio.app/docs/gradio/set_static_paths
Gradio - Set_Static_Paths Docs
Creates an image component that, as an input, can be used to upload and edit images using simple editing tools such as brushes, strokes, cropping, and layers. Or, as an output, this component can be used to display images.
Description
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
**Using ImageEditor as an input component.** How ImageEditor will pass its value to your function: Type: `EditorValue | None` Passes the uploaded images as an instance of EditorValue, which is just a `dict` with keys: 'background', 'layers', and 'composite'. * The values corresponding to 'background' and 'composi...
Behavior
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
Parameters ▼ value: EditorValue | ImageType | None default `= None` Optional initial image(s) to populate the image editor. Should be a dictionary with keys: `background`, `layers`, and `composite`. The values corresponding to `background` and `composite` should be images or None, while `layers` shoul...
Initialization
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
webcam', 'clipboard'] | None default `= ('upload', 'webcam', 'clipboard')` List of sources that can be used to set the background image. "upload" creates a box where user can drop an image file, "webcam" allows user to take snapshot from their webcam, "clipboard" allows users to paste an image from the clipboard. ...
Initialization
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
ent. Valid options are "download" to download the image, "share" to share to Hugging Face Spaces Discussions, and "fullscreen" to view in fullscreen mode. By default, all buttons are shown. container: bool default `= True` If True, will place the component in a container - providing some extra padding...
Initialization
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
er: bool default `= True` If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later. key: int | str | tuple[int | str, ...] | None default `= None` in a gr.render, Components with the same ke...
Initialization
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
also hide the eraser tool. See `gr.Brush` docs. format: str default `= "webp"` Format to save image if it does not already have a valid format (e.g. if the image is being returned to the frontend as a numpy array or PIL Image). The format should be supported by the PIL library. This parameter has no ...
Initialization
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
Shortcuts gradio.ImageEditor Interface String Shortcut `"imageeditor"` Initialization Uses default values gradio.Sketchpad Interface String Shortcut `"sketchpad"` Initialization Uses sources=(), brush=Brush(colors=["000000"], color_mode="fixed") gradio.Paint Interface S...
Shortcuts
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
image_editor
Demos
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
Description Event listeners allow you to respond to user interactions with the UI components you've defined in a Gradio Blocks app. When a user interacts with an element, such as changing a slider value or uploading an image, a function is called. Supported Event Listeners The ImageEditor component supports the foll...
Event Listeners
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component. ...
Event Listeners
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
nt area as well as a runtime display in the upper right corner, "minimal" only shows the runtime display, "hidden" shows no progress animation at all show_progress_on: Component | list[Component] | None default `= None` Component or list of components to show the progress animation on. If None, will s...
Event Listeners
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
ll cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish. trigger_mode: Literal['once', 'multiple', 'alway...
Event Listeners
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
en from API docs and not callable by the Gradio client libraries), or "undocumented" (hidden from API docs but callable by clients and via gr.load). If fn is None, api_visibility will automatically be set to "private". time_limit: int | None default `= None` stream_every: float default...
Event Listeners
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
Helper Classes
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
gradio.Brush(···) Description A dataclass for specifying options for the brush tool in the ImageEditor component. An instance of this class can be passed to the `brush` parameter of `gr.ImageEditor`. Initialization Parameters ▼ default_size: int | Literal['auto'] default `= "auto"` The default rad...
Brush
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
gradio.Eraser(···) Description A dataclass for specifying options for the eraser tool in the ImageEditor component. An instance of this class can be passed to the `eraser` parameter of `gr.ImageEditor`. Initialization Parameters ▼ default_size: int | Literal['auto'] default `= "auto"` The default ...
Eraser
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
gradio.LayerOptions(···) Description A dataclass for specifying options for the layer tool in the ImageEditor component. An instance of this class can be passed to the `layers` parameter of `gr.ImageEditor`. Initialization Parameters ▼ allow_additional_layers: bool default `= True` If True, users ...
Layer Options
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
gradio.WebcamOptions(···) Description A dataclass for specifying options for the webcam tool in the ImageEditor component. An instance of this class can be passed to the `webcam_options` parameter of `gr.ImageEditor`. Initialization Parameters ▼ mirror: bool default `= True` If True, the webcam wi...
Webcam Options
https://gradio.app/docs/gradio/imageeditor
Gradio - Imageeditor Docs
The gr.EditData class is a subclass of gr.Event data that specifically carries information about the `.edit()` event. When gr.EditData is added as a type hint to an argument of an event listener method, a gr.EditData object will automatically be passed as the value of that argument. The attributes of this object contai...
Description
https://gradio.app/docs/gradio/editdata
Gradio - Editdata Docs
import gradio as gr def edit(edit_data: gr.EditData, history: list[gr.MessageDict]): history_up_to_edit = history[:edit_data.index] history_up_to_edit[-1] = edit_data.value return history_up_to_edit with gr.Blocks() as demo: chatbot = gr.Chatbot() chatbot.undo(e...
Example Usage
https://gradio.app/docs/gradio/editdata
Gradio - Editdata Docs
Parameters ▼ index: int | tuple[int, int] The index of the message that was edited. previous_value: Any The previous content of the message that was edited. value: Any The new content of the message that was edited. [Chatbot Specific Events](../../guides/chatbot-speci...
Attributes
https://gradio.app/docs/gradio/editdata
Gradio - Editdata Docs
Displays a classification label, along with confidence scores of top categories, if provided. As this component does not accept user input, it is rarely used as an input component.
Description
https://gradio.app/docs/gradio/label
Gradio - Label Docs
**Using Label as an input component.** How Label will pass its value to your function: Type: `dict[str, float] | str | int | float | None` Depending on the value, passes the label as a `str | int | float`, or the labels and confidences as a `dict[str, float]`. Example Code import gradio ...
Behavior
https://gradio.app/docs/gradio/label
Gradio - Label Docs
Parameters ▼ value: dict[str, float] | str | float | Callable | None default `= None` Default value to show in the component. If a str or number is provided, simply displays the string or number. If a {Dict[str, float]} of classes and confidences is provided, displays the top class on top and the `num...
Initialization
https://gradio.app/docs/gradio/label
Gradio - Label Docs
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` minimum pixel width, will wrap if not sufficient screen spa...
Initialization
https://gradio.app/docs/gradio/label
Gradio - Label Docs
ameters will be preserved in the UI (if they have been changed by the user or an event listener) instead of re-rendered based on the values provided during constructor. color: str | None default `= None` The background color of the label (either a valid css color name or hexadecimal string). ...
Initialization
https://gradio.app/docs/gradio/label
Gradio - Label Docs
Shortcuts gradio.Label Interface String Shortcut `"label"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/label
Gradio - Label 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 Label component supports the following ...
Event Listeners
https://gradio.app/docs/gradio/label
Gradio - Label Docs
| BlockContext | list[Component | BlockContext] | Set[Component | BlockContext] | None default `= None` List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list. api_name: str | None default `= None` defines how the endpoint appears in the API do...
Event Listeners
https://gradio.app/docs/gradio/label
Gradio - Label Docs
If None, will use the queue setting of the gradio app. batch: bool default `= False` If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The fu...
Event Listeners
https://gradio.app/docs/gradio/label
Gradio - Label Docs
.key_up()` events) would allow a second submission after the pending event is complete. js: str | Literal[True] | None default `= None` Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for outp...
Event Listeners
https://gradio.app/docs/gradio/label
Gradio - Label Docs
validator: Callable | None default `= None` Optional validation function to run before the main function. If provided, this function will be executed first with queue=False, and only if it completes successfully will the main function be called. The validator receives the same inputs as the main function and should ...
Event Listeners
https://gradio.app/docs/gradio/label
Gradio - Label Docs
The Dependency object is usually not created directly but is returned when an event listener is set up. It contains the configuration data for the event listener, and can be used to set up additional event listeners that depend on the completion of the current event listener using .then(), .success(), and .failure(). ...
Description
https://gradio.app/docs/gradio/dependency
Gradio - Dependency Docs
import gradio as gr with gr.Blocks() as demo: first_textbox = gr.Textbox() second_textbox = gr.Textbox() button = gr.Button("Submit") dependency = button.click(lambda x: "Hello, " + x, first_textbox, second_textbox) dependency.success(lambda: gr.Info("Greeting succ...
Example Usage
https://gradio.app/docs/gradio/dependency
Gradio - Dependency Docs
chatbot_consecutiveblocks_chained_events
Demos
https://gradio.app/docs/gradio/dependency
Gradio - Dependency Docs
Creates a slider that ranges from `minimum` to `maximum` with a step size of `step`.
Description
https://gradio.app/docs/gradio/slider
Gradio - Slider Docs
**Using Slider as an input component.** How Slider will pass its value to your function: Type: `float` Passes slider value as a `float` into the function. Example Code import gradio as gr def predict( value: float ): process value from the Sli...
Behavior
https://gradio.app/docs/gradio/slider
Gradio - Slider Docs
Parameters ▼ minimum: float default `= 0` minimum value for slider. When used as an input, if a user provides a smaller value, a gr.Error exception is raised by the backend. maximum: float default `= 100` maximum value for slider. When used as an input, if a user provides a larger va...
Initialization
https://gradio.app/docs/gradio/slider
Gradio - Slider Docs
used as inputs to calculate `value` if `value` is a function (has no effect otherwise). `value` is recalculated any time the inputs change. show_label: bool | None default `= None` if True, will display label. container: bool default `= True` If True, will place the component in a co...
Initialization
https://gradio.app/docs/gradio/slider
Gradio - Slider Docs
render: bool default `= True` If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later. key: int | str | tuple[int | str, ...] | None default `= None` in a gr.render, Components with ...
Initialization
https://gradio.app/docs/gradio/slider
Gradio - Slider Docs
Shortcuts gradio.Slider Interface String Shortcut `"slider"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/slider
Gradio - Slider Docs
Logarithmic scale Sliders are linear by default. For parameters that vary over several orders of magnitude (e.g. learning rate), map the slider value inside your function: import gradio as gr def train(lr_exp): lr = 10 ** lr_exp slider value -5 → lr 0.00001 return f"Training wi...
Common Patterns
https://gradio.app/docs/gradio/slider
Gradio - Slider Docs