text
stringlengths
0
2k
heading1
stringlengths
3
79
source_page_url
stringclasses
189 values
source_page_title
stringclasses
189 values
![](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....
keys
https://gradio.app/docs/gradio/cache-class
Gradio - Cache Class 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....
keys
https://gradio.app/docs/gradio/cache-class
Gradio - Cache Class 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....
clear
https://gradio.app/docs/gradio/cache-class
Gradio - Cache Class 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...
clear
https://gradio.app/docs/gradio/cache-class
Gradio - Cache Class 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
Creates a button that can be assigned arbitrary .click() events. The value (label) of the button can be used as an input to the function (rarely used) or set via the output of a function.
Description
https://gradio.app/docs/gradio/button
Gradio - Button Docs
**Using Button as an input component.** How Button will pass its value to your function: Type: `str | None` (Rarely used) the `str` corresponding to the button label when the button is clicked Example Code import gradio as gr def predict( value: str | None ...
Behavior
https://gradio.app/docs/gradio/button
Gradio - Button Docs
Parameters ▼ value: str | I18nData | Callable default `= "Run"` default text for the button to display. If a function is provided, the function will be called each time the app loads to set the initial value of this component. every: Timer | float | None default `= None` continuously...
Initialization
https://gradio.app/docs/gradio/button
Gradio - Button Docs
iteral['hidden'] default `= True` If False, component will be hidden. If "hidden", component will be visually hidden and not take up space in the layout but still exist in the DOM interactive: bool default `= True` if False, the Button will be in a disabled state. elem_id: str | None...
Initialization
https://gradio.app/docs/gradio/button
Gradio - Button Docs
scale applies in Rows, and to top-level Components in Blocks where fill_height=True. min_width: int | None default `= None` minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_wid...
Initialization
https://gradio.app/docs/gradio/button
Gradio - Button Docs
Shortcuts gradio.Button Interface String Shortcut `"button"` Initialization Uses default values gradio.ClearButton Interface String Shortcut `"clearbutton"` Initialization Uses default values gradio.DeepLinkButton Interface String Shortcut `"deeplinkbutton"` Initializa...
Shortcuts
https://gradio.app/docs/gradio/button
Gradio - Button Docs
Description Event listeners allow you to respond to user interactions with the UI components you've defined in a Gradio Blocks app. When a user interacts with an element, such as changing a slider value or uploading an image, a function is called. Supported Event Listeners The Button component supports the following...
Event Listeners
https://gradio.app/docs/gradio/button
Gradio - Button Docs
api_name: str | None default `= None` defines how the endpoint appears in the API docs. Can be a string or None. If set to a string, the endpoint will be exposed in the API docs with the given name. If None (default), the name of the function will be used as the API endpoint. api_description: str | N...
Event Listeners
https://gradio.app/docs/gradio/button
Gradio - Button Docs
ter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component. max_batch_size: int default `= 4` Maximum number of...
Event Listeners
https://gradio.app/docs/gradio/button
Gradio - Button Docs
method are values of 'inputs' and 'outputs', return should be a list of values for output components. concurrency_limit: int | None | Literal['default'] default `= "default"` If set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_...
Event Listeners
https://gradio.app/docs/gradio/button
Gradio - Button Docs
tion be called. The validator receives the same inputs as the main function and should return a `gr.validate()` for each input value.
Event Listeners
https://gradio.app/docs/gradio/button
Gradio - Button Docs
Gradio includes pre-built components that can be used as inputs or outputs in your Interface or Blocks with a single line of code. Components include preprocessing steps that convert user data submitted through browser to something that be can used by a Python function, and postprocessing steps to convert values return...
Introduction
https://gradio.app/docs/gradio/introduction
Gradio - Introduction Docs
Components also come with certain events that they support. These are methods that are triggered with user actions. Below is a table showing which events are supported for each component. All events are also listed (with parameters) in the component’s docs. | download| delete| edit| end| retry| pause_recording| double...
Events
https://gradio.app/docs/gradio/introduction
Gradio - Introduction Docs
| ✕| ✕| ✕ [Code](code)| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✓| ✕| ✕| ✕| ✕| ✕| ✕| ✓| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✓| ✕| ✕| ✕| ✕| ✓| ✕ [ColorPicker](colorpicker)| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✓| ✕| ✕| ✕| ✕| ✕| ✕| ✓| ✕| ✕| ✓| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✓| ✓| ✕| ✕| ✕| ✓| ✕ [Dataframe](dataframe)| ✕| ✕| ✓| ✕| ✕| ✕| ✕| ✕| ...
Events
https://gradio.app/docs/gradio/introduction
Gradio - Introduction Docs
✓| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✓| ✕| ✕| ✓| ✕| ✕| ✓| ✓| ✕| ✕ [HighlightedText](highlightedtext)| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✓| ✕| ✕| ✕| ✓| ✕| ✕ [HTML](html)| ✓| ✓| ✓| ✓| ✓| ✓| ✓| ✓| ✕| ✓| ✓| ✓| ✓| ✓| ✓| ✓| ✓| ✓| ✓| ✓| ✓| ✓| ✓| ✓| ✓| ...
Events
https://gradio.app/docs/gradio/introduction
Gradio - Introduction Docs
ScatterPlot](scatterplot)| ✕| ✕| ✕| ✕| ✕| ✕| ✓| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✓| ✕| ✕| ✕| ✓| ✕| ✕ [Navbar](navbar)| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✓| ✕| ✕| ✕| ✕| ✕| ✕ [Number](number)| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✕| ✓| ✕| ...
Events
https://gradio.app/docs/gradio/introduction
Gradio - Introduction Docs
Creates a component with arbitrary HTML. Can include CSS and JavaScript to create highly customized and interactive components.
Description
https://gradio.app/docs/gradio/html
Gradio - Html Docs
**Using HTML as an input component.** How HTML will pass its value to your function: Type: `str | None` (Rarely used) passes the HTML as a `str`. Example Code import gradio as gr def predict( value: str | None ): process value from the HTML co...
Behavior
https://gradio.app/docs/gradio/html
Gradio - Html Docs
Parameters ▼ value: Any | Callable | None default `= None` The HTML content in the ${value} tag in the html_template. For example, if html_template="<p>${value}</p>" and value="Hello, world!", the component will render as `"<p>Hello, world!</p>"`. label: str | I18nData | None default ...
Initialization
https://gradio.app/docs/gradio/html
Gradio - Html Docs
()`. The `trigger` function can be used to trigger events, such as `trigger('click')`. The value and other props can be edited through `props`, e.g. `props.value = "new value"` which will re-render the HTML template. If `server_functions` is provided, a `server` object is also available in `js_on_load`, where each func...
Initialization
https://gradio.app/docs/gradio/html
Gradio - Html Docs
. scale: int | None default `= None` relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=T...
Initialization
https://gradio.app/docs/gradio/html
Gradio - Html Docs
s constructor. Inside a gr.render() function, if a component is re-rendered with the same key, these (and only these) parameters will be preserved in the UI (if they have been changed by the user or an event listener) instead of re-rendered based on the values provided during constructor. min_height: in...
Initialization
https://gradio.app/docs/gradio/html
Gradio - Html Docs
d for `<script>` and `<link>` tags to load third-party libraries. Scripts are deduplicated by `src` and links by `href`, so multiple components requiring the same library won't load it twice. server_functions: list[Callable] | None default `= None` A list of Python functions that can be called from `j...
Initialization
https://gradio.app/docs/gradio/html
Gradio - Html Docs
Shortcuts gradio.HTML Interface String Shortcut `"html"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/html
Gradio - Html Docs
super_html
Demos
https://gradio.app/docs/gradio/html
Gradio - Html Docs
Description Event listeners allow you to respond to user interactions with the UI components you've defined in a Gradio Blocks app. When a user interacts with an element, such as changing a slider value or uploading an image, a function is called. Supported Event Listeners The HTML component supports the following e...
Event Listeners
https://gradio.app/docs/gradio/html
Gradio - Html Docs
, ···) This listener is triggered when the user reaches the end of the media playing in the HTML. HTML.start_recording(fn, ···) This listener is triggered when the user starts recording with the HTML. HTML.pause_recording(fn, ···) This listener is triggered when the user pauses recordin...
Event Listeners
https://gradio.app/docs/gradio/html
Gradio - Html Docs
ta.index and SelectData.value. See SelectData documentation on how to use this event data. HTML.option_select(fn, ···) This listener is triggered when the user clicks on an option from within the HTML. This event has SelectData of type gradio.SelectData that carries information, accessible through Selec...
Event Listeners
https://gradio.app/docs/gradio/html
Gradio - Html Docs
e as a FileData object. See EventData documentation on how to use this event data HTML.copy(fn, ···) This listener is triggered when the user copies content from the HTML. Uses event data gradio.CopyData to carry information about the copied content. See EventData documentation on how to use this event ...
Event Listeners
https://gradio.app/docs/gradio/html
Gradio - Html Docs
he function's docstring will be used as the API endpoint description. If False, then no description will be displayed in the API docs. scroll_to_output: bool default `= False` If True, will scroll to output component on completion show_progress: Literal['full', 'minimal', 'hidden'] de...
Event Listeners
https://gradio.app/docs/gradio/html
Gradio - Html Docs
g 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component). postprocess: bool default `= True` If False, will not run postprocessing of component data before returning 'fn' output to the browser. cancels: dict[str, Any] | list[dict[str, Any]] | None...
Event Listeners
https://gradio.app/docs/gradio/html
Gradio - Html Docs
1 by default). concurrency_id: str | None default `= None` If set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit. api_visibility: Literal['public', 'private', 'undocumented'] default `= "public"` contr...
Event Listeners
https://gradio.app/docs/gradio/html
Gradio - Html Docs
Creates a line plot component to display data from a pandas DataFrame.
Description
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
**Using LinePlot as an input component.** How LinePlot will pass its value to your function: Type: `PlotData | None` The data to display in a line plot. Example Code import gradio as gr def predict( value: PlotData | None ): process value from...
Behavior
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
Parameters ▼ value: pd.DataFrame | Callable | None default `= None` The pandas dataframe containing the data to display in the plot. x: str | None default `= None` Column corresponding to the x axis. Column can be numeric, datetime, or string/category. y: str | None ...
Initialization
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
ne` List containing column names of the series to show in the legend. By default, all series are shown. x_lim: list[float | None] | None default `= None` A tuple or list containing the limits for the x-axis, specified as [x_min, x_max]. To fix only one of these values, set the other to None, e.g. [0,...
Initialization
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
", "-x", "-y", or list of strings that represent the order of the categories. tooltip: Literal['axis', 'none', 'all'] | list[str] default `= "axis"` The tooltip to display when hovering on a point. "axis" shows the values for the axis columns, "all" shows all column values, and "none" shows no tooltip...
Initialization
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
uts: Component | list[Component] | Set[Component] | None default `= None` Components that are used as inputs to calculate `value` if `value` is a function (has no effect otherwise). `value` is recalculated any time the inputs change. visible: bool | Literal['hidden'] default `= True` Whether the plo...
Initialization
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
-render. preserved_by_key: list[str] | str | None default `= "value"` A list of parameters from this component's constructor. Inside a gr.render() function, if a component is re-rendered with the same key, these (and only these) parameters will be preserved in the UI (if they have been changed by the ...
Initialization
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
`gr.LinePlot`, `gr.ScatterPlot`, and `gr.BarPlot` all share the same API. Here is a summary of the most important features. For full details and live demos, see the [Creating Plots](/guides/creating-plots) and [Time Plots](/guides/time-plots) guides. **Basic Usage with a DataFrame** Pass a `pd.DataFrame` as the value...
Key Concepts
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
ex[0], selection.index[1]]) plot.double_click(lambda: gr.LinePlot(x_lim=None), outputs=plot) **Realtime Data** Use `gr.Timer` to keep plots updated with live data. You can attach the timer via `every`, or wire it up manually: def get_data(): return pd.DataFrame(...) fetch latest d...
Key Concepts
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
Shortcuts gradio.LinePlot Interface String Shortcut `"lineplot"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
line_plot_demo
Demos
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot 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 LinePlot component supports the followi...
Event Listeners
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
omponents 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 sh...
Event Listeners
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
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 accept ...
Event Listeners
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
ding. 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...
Event Listeners
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
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 com...
Event Listeners
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot 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
Gradio features a built-in theming engine that lets you customize the look and feel of your app. You can choose from a variety of themes, or create your own. To do so, pass the `theme=` kwarg to the `Blocks` or `Interface` constructor. For example: with gr.Blocks(theme=gr.themes.Soft()) as demo: ...
Introduction
https://gradio.app/docs/gradio/themes
Gradio - Themes Docs
The easiest way to build a theme is using the Theme Builder. To launch the Theme Builder locally, run the following code: import gradio as gr gr.themes.builder() You can use the Theme Builder running on Spaces above, though it runs much faster when you launch it locally via `gr.themes.builder()...
Using the Theme Builder
https://gradio.app/docs/gradio/themes
Gradio - Themes Docs
Constructor Although each theme has hundreds of CSS variables, the values for most these variables are drawn from 8 core variables which can be set through the constructor of each prebuilt theme. Modifying these 8 arguments allows you to quickly change the look and feel of your app.
Extending Themes via the
https://gradio.app/docs/gradio/themes
Gradio - Themes Docs
The first 3 constructor arguments set the colors of the theme and are `gradio.themes.Color` objects. Internally, these Color objects hold brightness values for the palette of a single hue, ranging from 50, 100, 200…, 800, 900, 950. Other CSS variables are derived from these 3 colors. The 3 color constructor arguments ...
Core Colors
https://gradio.app/docs/gradio/themes
Gradio - Themes Docs
The next 3 constructor arguments set the sizing of the theme and are `gradio.themes.Size` objects. Internally, these Size objects hold pixel size values that range from `xxs` to `xxl`. Other CSS variables are derived from these 3 sizes. * — `spacing_size`: This sets the padding within and spacing between elements. I...
Core Sizing
https://gradio.app/docs/gradio/themes
Gradio - Themes Docs
The final 2 constructor arguments set the fonts of the theme. You can pass a list of fonts to each of these arguments to specify fallbacks. If you provide a string, it will be loaded as a system font. If you provide a `gradio.themes.GoogleFont`, the font will be loaded from Google Fonts. * — `font`: This sets the pr...
Core Fonts
https://gradio.app/docs/gradio/themes
Gradio - Themes Docs
You can also modify the values of CSS variables after the theme has been loaded. To do so, use the `.set()` method of the theme object to get access to the CSS variables. For example: theme = gr.themes.Default(primary_hue="blue").set( loader_color="FF0000", slider_color="FF0000", ) ...
Extending Themes via `.set()`
https://gradio.app/docs/gradio/themes
Gradio - Themes Docs
Conventions CSS variable names can get quite long, like `button_primary_background_fill_hover_dark`! However they follow a common naming convention that makes it easy to understand what they do and to find the variable you’re looking for. Separated by underscores, the variable name is made up of: * — 1. The target ...
CSS Variable Naming
https://gradio.app/docs/gradio/themes
Gradio - Themes Docs
Though there are hundreds of CSS variables, they do not all have to have individual values. They draw their values by referencing a set of core variables and referencing each other. This allows us to only have to modify a few variables to change the look and feel of the entire theme, while also getting finer control of...
CSS Variable Organization
https://gradio.app/docs/gradio/themes
Gradio - Themes Docs
Variables can also reference each other. For example, look at the example below: theme = gr.themes.Default().set( button_primary_background_fill="FF0000", button_primary_background_fill_hover="FF0000", button_primary_border="FF0000", ) Having to set these values to a common c...
Referencing Other Variables
https://gradio.app/docs/gradio/themes
Gradio - Themes Docs
Let’s say you want to create a theme from scratch! We’ll go through it step by step - you can also see the source of prebuilt themes in the gradio source repo for reference - [here’s the source](https://github.com/gradio- app/gradio/blob/main/gradio/themes/monochrome.py) for the Monochrome theme. Our new theme class w...
Creating a Full Theme
https://gradio.app/docs/gradio/themes
Gradio - Themes Docs
ctor useful to select elements from the UI and see what CSS variables are being used in the styles panel. Sharing Themes Once you have created a theme, you can upload it to the HuggingFace Hub to let others view it, use it, and build off of it!
Creating a Full Theme
https://gradio.app/docs/gradio/themes
Gradio - Themes Docs
There are two ways to upload a theme, via the theme class instance or the command line. We will cover both of them with the previously created `seafoam` theme. * Via the class instance Each theme instance has a method called `push_to_hub` we can use to upload a theme to the HuggingFace hub. seafoam.p...
Uploading a Theme
https://gradio.app/docs/gradio/themes
Gradio - Themes Docs
By calling `push_to_hub` or `upload_theme`, the theme assets will be stored in a [HuggingFace space](https://huggingface.co/docs/hub/spaces-overview). The theme preview for our seafoam theme is here: [seafoam preview](https://huggingface.co/spaces/gradio/seafoam).
Theme Previews
https://gradio.app/docs/gradio/themes
Gradio - Themes Docs
The [Theme Gallery](https://huggingface.co/spaces/gradio/theme-gallery) shows all the public gradio themes. After publishing your theme, it will automatically show up in the theme gallery after a couple of minutes. You can sort the themes by the number of likes on the space and from most to least recently created as w...
Discovering Themes
https://gradio.app/docs/gradio/themes
Gradio - Themes Docs
To use a theme from the hub, use the `from_hub` method on the `ThemeClass` and pass it to your app: my_theme = gr.Theme.from_hub("gradio/seafoam") with gr.Blocks(theme=my_theme) as demo: .... You can also pass the theme string directly to `Blocks` or `Interface` (`gr.Blocks(theme="gradi...
Downloading
https://gradio.app/docs/gradio/themes
Gradio - Themes Docs
Creates a Dialogue component for displaying or collecting multi-speaker conversations. This component can be used as input to allow users to enter dialogue involving multiple speakers, or as output to display diarized speech, such as the result of a transcription or speaker identification model. Each message can be ass...
Description
https://gradio.app/docs/gradio/dialogue
Gradio - Dialogue Docs
**Using Dialogue as an input component.** How Dialogue will pass its value to your function: Type: `str | list[dict[str, str]]` Returns the dialogue as a string or list of dictionaries. Example Code import gradio as gr def predict( value: str | list[dict[str, str...
Behavior
https://gradio.app/docs/gradio/dialogue
Gradio - Dialogue Docs
Parameters ▼ value: list[dict[str, str]] | Callable | None default `= None` Value of the dialogue. It is a list of dictionaries, each containing a 'speaker' key and a 'text' key. 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/dialogue
Gradio - Dialogue Docs
tor: str default `= " "` The separator between the different dialogue lines used to join the formatted dialogue lines into a single string. It should be unambiguous. For example, a newline character or tab character. color_map: dict[str, str] | None default `= None` A dictionary mapping speaker name...
Initialization
https://gradio.app/docs/gradio/dialogue
Gradio - Dialogue Docs
um 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. interactive: bool | None default `= None` if True, will be rendered as an editable textbox;...
Initialization
https://gradio.app/docs/gradio/dialogue
Gradio - Dialogue Docs
identity across a re-render. Components that have the same key across a re-render will have their value preserved. max_lines: int | None default `= None` maximum number of lines allowed in the dialogue. buttons: list[Literal['copy'] | Button] | None default `= None` A list of buttons...
Initialization
https://gradio.app/docs/gradio/dialogue
Gradio - Dialogue Docs
Shortcuts gradio.Dialogue Interface String Shortcut `"dialogue"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/dialogue
Gradio - Dialogue Docs
dia_dialogue_demo
Demos
https://gradio.app/docs/gradio/dialogue
Gradio - Dialogue 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 Dialogue component supports the followi...
Event Listeners
https://gradio.app/docs/gradio/dialogue
Gradio - Dialogue Docs
et[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 docs. Can be a string or None. If set to a string, the...
Event Listeners
https://gradio.app/docs/gradio/dialogue
Gradio - Dialogue Docs
pp. 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 function is then *required* to return a tuple of lists...
Event Listeners
https://gradio.app/docs/gradio/dialogue
Gradio - Dialogue Docs
fter 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 output components. concurrency_limit: in...
Event Listeners
https://gradio.app/docs/gradio/dialogue
Gradio - Dialogue Docs
nal 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 return a `gr.validate()` for each input value.
Event Listeners
https://gradio.app/docs/gradio/dialogue
Gradio - Dialogue 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