text
stringlengths
0
2k
heading1
stringlengths
3
79
source_page_url
stringclasses
189 values
source_page_title
stringclasses
189 values
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 LoginButton component supports the foll...
Event Listeners
https://gradio.app/docs/gradio/loginbutton
Gradio - Loginbutton 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_descr...
Event Listeners
https://gradio.app/docs/gradio/loginbutton
Gradio - Loginbutton Docs
for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component. max_batch_size: int default `= 4` Ma...
Event Listeners
https://gradio.app/docs/gradio/loginbutton
Gradio - Loginbutton Docs
guments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components. concurrency_limit: int | None | Literal['default'] default `= "default"` If set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean ...
Event Listeners
https://gradio.app/docs/gradio/loginbutton
Gradio - Loginbutton Docs
l 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. [Sharing Your App](../../guides/sharing-your-app/)
Event Listeners
https://gradio.app/docs/gradio/loginbutton
Gradio - Loginbutton Docs
Creates a file component that allows uploading one or more generic files (when used as an input) or displaying generic files or URLs for download (as output). Demo: zip_files, zip_to_json
Description
https://gradio.app/docs/gradio/file
Gradio - File Docs
**Using File as an input component.** How File will pass its value to your function: Type: `bytes | str | list[bytes] | list[str] | None` Passes the file as a `str` or `bytes` object, or a list of `str` or list of `bytes` objects, depending on `type` and `file_count`. Example Code import...
Behavior
https://gradio.app/docs/gradio/file
Gradio - File Docs
Parameters ▼ value: str | list[str] | Callable | None default `= None` Default file(s) to display, given as a str file path or URL, or a list of str file paths / URLs. 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/file
Gradio - File Docs
er whose tick resets `value`, or a float that provides the regular interval for the reset Timer. inputs: Component | list[Component] | set[Component] | None default `= None` Components that are used as inputs to calculate `value` if `value` is a function (has no effect otherwise). `value` is recalcula...
Initialization
https://gradio.app/docs/gradio/file
Gradio - File Docs
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 exist in the DOM elem_id: str | None default `= None` An optional string that is assigned as the id of this ...
Initialization
https://gradio.app/docs/gradio/file
Gradio - File Docs
Shortcuts gradio.File Interface String Shortcut `"file"` Initialization Uses default values gradio.Files Interface String Shortcut `"files"` Initialization Uses file_count="multiple"
Shortcuts
https://gradio.app/docs/gradio/file
Gradio - File 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 File component supports the following e...
Event Listeners
https://gradio.app/docs/gradio/file
Gradio - File Docs
ded file as a FileData object. See EventData documentation on how to use this event data Event Parameters Parameters ▼ fn: Callable | None | Literal['decorator'] default `= "decorator"` the function to call when this event is triggered. Often a machine learning model's prediction function. Each para...
Event Listeners
https://gradio.app/docs/gradio/file
Gradio - File Docs
n completion show_progress: Literal['full', 'minimal', 'hidden'] default `= "full"` how to show the progress animation while event is running: "full" shows a spinner which covers the output component area as well as a runtime display in the upper right corner, "minimal" only shows the runtime display,...
Event Listeners
https://gradio.app/docs/gradio/file
Gradio - File Docs
o the browser. cancels: dict[str, Any] | list[dict[str, Any]] | None default `= None` A list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Fun...
Event Listeners
https://gradio.app/docs/gradio/file
Gradio - File Docs
isibility: Literal['public', 'private', 'undocumented'] default `= "public"` controls the visibility and accessibility of this endpoint. Can be "public" (shown in API docs and callable by clients), "private" (hidden from API docs and not callable by the Gradio client libraries), or "undocumented" (hidden from API doc...
Event Listeners
https://gradio.app/docs/gradio/file
Gradio - File Docs
Used to render arbitrary Markdown output. Can also render latex enclosed by dollar signs as well as code blocks with syntax highlighting. Supported languages are bash, c, cpp, go, java, javascript, json, php, python, rust, sql, and yaml. As this component does not accept user input, it is rarely used as an input compon...
Description
https://gradio.app/docs/gradio/markdown
Gradio - Markdown Docs
**Using Markdown as an input component.** How Markdown will pass its value to your function: Type: `str | None` Passes the `str` of Markdown corresponding to the displayed value. Example Code import gradio as gr def predict( value: str | None ): ...
Behavior
https://gradio.app/docs/gradio/markdown
Gradio - Markdown Docs
Parameters ▼ value: str | I18nData | Callable | None default `= None` Value to show in Markdown component. If a function is provided, the function will be called each time the app loads to set the initial value of this component. label: str | I18nData | None default `= None` This par...
Initialization
https://gradio.app/docs/gradio/markdown
Gradio - Markdown Docs
None` A list of dicts of the form {"left": open delimiter (str), "right": close delimiter (str), "display": whether to display in newline (bool)} that will be used to render LaTeX expressions. If not provided, `latex_delimiters` is set to `[{ "left": "$$", "right": "$$", "display": True }]`, so only expressions enclo...
Initialization
https://gradio.app/docs/gradio/markdown
Gradio - Markdown Docs
endered 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. sanitize_html: bool default `= True` If False, will disable HTML sanitization wh...
Initialization
https://gradio.app/docs/gradio/markdown
Gradio - Markdown Docs
] | None default `= None` A list of buttons to show for the component. Currently, the only valid option is "copy". The "copy" button allows the user to copy the text in the Markdown component. By default, no buttons are shown. container: bool default `= False` If True, the Markdown component will be...
Initialization
https://gradio.app/docs/gradio/markdown
Gradio - Markdown Docs
Shortcuts gradio.Markdown Interface String Shortcut `"markdown"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/markdown
Gradio - Markdown Docs
blocks_helloblocks_kinematics
Demos
https://gradio.app/docs/gradio/markdown
Gradio - Markdown 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 Markdown component supports the followi...
Event Listeners
https://gradio.app/docs/gradio/markdown
Gradio - Markdown 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/markdown
Gradio - Markdown 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/markdown
Gradio - Markdown 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/markdown
Gradio - Markdown 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/markdown
Gradio - Markdown Docs
Sidebar is a collapsible panel that renders child components on the left side of the screen within a Blocks layout.
Description
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
with gr.Blocks() as demo: with gr.Sidebar(): gr.Textbox() gr.Button()
Example Usage
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
Parameters ▼ label: str | I18nData | None default `= None` name of the sidebar. Not displayed to the user. open: bool default `= True` if True, sidebar is open by default. visible: bool | Literal['hidden'] default `= True` elem_id: str | None default...
Initialization
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
Methods
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar 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....
expand
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar 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%20...
expand
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
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[Component | BlockContext] | Set[Component | BlockContext] | None default `= None` List of gradio.co...
expand
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
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 output components. queue: bool default `= True` If True, will place the request on t...
expand
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
ators 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 "once" (default for all events except `.change()`) would not allow any submissions while an event is pend...
expand
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
oad). 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 | tuple[int | str, ...] | None default `= None` A unique key for this event listener to be used in @g...
expand
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar 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....
collapse
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar 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%...
collapse
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
nds 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[Component | BlockContext] | Set[Component | BlockContext] | None default `= None` List of gradio...
collapse
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
on 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 output components. queue: bool default `= True` If True, will place the request o...
collapse
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
nerators 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 "once" (default for all events except `.change()`) would not allow any submissions while an event is p...
collapse
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
r.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 | tuple[int | str, ...] | None default `= None` A unique key for this event listener to be used in...
collapse
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar 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....
expand
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar 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%20...
expand
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
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[Component | BlockContext] | Set[Component | BlockContext] | None default `= None` List of gradio.co...
expand
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
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 output components. queue: bool default `= True` If True, will place the request on t...
expand
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
ators 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 "once" (default for all events except `.change()`) would not allow any submissions while an event is pend...
expand
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
oad). 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 | tuple[int | str, ...] | None default `= None` A unique key for this event listener to be used in @g...
expand
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar 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....
collapse
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar 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%...
collapse
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
nds 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[Component | BlockContext] | Set[Component | BlockContext] | None default `= None` List of gradio...
collapse
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
on 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 output components. queue: bool default `= True` If True, will place the request o...
collapse
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
nerators 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 "once" (default for all events except `.change()`) would not allow any submissions while an event is p...
collapse
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
r.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 | tuple[int | str, ...] | None default `= None` A unique key for this event listener to be used in...
collapse
https://gradio.app/docs/gradio/sidebar
Gradio - Sidebar Docs
Creates a gallery or table to display data samples. This component is primarily designed for internal use to display examples. However, it can also be used directly to display a dataset and let users select examples.
Description
https://gradio.app/docs/gradio/dataset
Gradio - Dataset Docs
**Using Dataset as an input component.** How Dataset will pass its value to your function: Type: `int | list | tuple[int, list] | None` Passes the selected sample either as a `list` of data corresponding to each input component (if `type` is "value") or as an `int` index (if `type` is "index"), or as a `tuple` of th...
Behavior
https://gradio.app/docs/gradio/dataset
Gradio - Dataset Docs
Parameters ▼ label: str | I18nData | None default `= None` the label for this component, appears above the component. show_label: bool default `= True` If True, the label will be shown above the component. components: list[Component] | list[str] | None default `= Non...
Initialization
https://gradio.app/docs/gradio/dataset
Gradio - Dataset Docs
re more than one component, the layout can only be "table". samples_per_page: int default `= 10` how many examples to show per page. visible: bool | Literal['hidden'] default `= True` If False, component will be hidden. If "hidden", component will be visually hidden and not take up s...
Initialization
https://gradio.app/docs/gradio/dataset
Gradio - Dataset 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=True. ...
Initialization
https://gradio.app/docs/gradio/dataset
Gradio - Dataset Docs
Shortcuts gradio.Dataset Interface String Shortcut `"dataset"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/dataset
Gradio - Dataset Docs
**Updating a Dataset** In this example, we display a text dataset using `gr.Dataset` and then update it when the user clicks a button: import gradio as gr philosophy_quotes = [ ["I think therefore I am."], ["The unexamined life is not worth living."] ] startup_quote...
Examples
https://gradio.app/docs/gradio/dataset
Gradio - Dataset 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 Dataset component supports the followin...
Event Listeners
https://gradio.app/docs/gradio/dataset
Gradio - Dataset Docs
e function takes no inputs, this should be an empty list. outputs: Component | BlockContext | list[Component | BlockContext] | Set[Component | BlockContext] | None default `= None` List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list. ...
Event Listeners
https://gradio.app/docs/gradio/dataset
Gradio - Dataset Docs
enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app. batch: bool default `= False` If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each p...
Event Listeners
https://gradio.app/docs/gradio/dataset
Gradio - Dataset Docs
ited 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 running 'fn'. Input arguments fo...
Event Listeners
https://gradio.app/docs/gradio/dataset
Gradio - Dataset Docs
dentifies 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 completes successfully will the main...
Event Listeners
https://gradio.app/docs/gradio/dataset
Gradio - Dataset Docs
The gr.CopyData class is a subclass of gr.EventData that specifically carries information about the `.copy()` event. When gr.CopyData is added as a type hint to an argument of an event listener method, a gr.CopyData object will automatically be passed as the value of that argument. The attributes of this object contain...
Description
https://gradio.app/docs/gradio/copydata
Gradio - Copydata Docs
import gradio as gr def on_copy(copy_data: gr.CopyData): return f"Copied text: {copy_data.value}" with gr.Blocks() as demo: textbox = gr.Textbox("Hello World!") copied = gr.Textbox() textbox.copy(on_copy, None, copied) demo.launch()
Example Usage
https://gradio.app/docs/gradio/copydata
Gradio - Copydata Docs
Parameters ▼ value: Any The value that was copied.
Attributes
https://gradio.app/docs/gradio/copydata
Gradio - Copydata 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
Accordion is a layout element which can be toggled to show/hide the contained content.
Description
https://gradio.app/docs/gradio/accordion
Gradio - Accordion Docs
with gr.Accordion("See Details"): gr.Markdown("lorem ipsum")
Example Usage
https://gradio.app/docs/gradio/accordion
Gradio - Accordion Docs
Parameters ▼ label: str | I18nData | None default `= None` name of accordion section. open: bool default `= True` if True, accordion is open by default. visible: bool | Literal['hidden'] default `= True` elem_id: str | None default `= None` An optio...
Initialization
https://gradio.app/docs/gradio/accordion
Gradio - Accordion Docs
Methods
https://gradio.app/docs/gradio/accordion
Gradio - Accordion 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....
expand
https://gradio.app/docs/gradio/accordion
Gradio - Accordion 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%...
expand
https://gradio.app/docs/gradio/accordion
Gradio - Accordion Docs
onds 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[Component | BlockContext] | Set[Component | BlockContext] | None default `= None` List of gradi...
expand
https://gradio.app/docs/gradio/accordion
Gradio - Accordion Docs
ion 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 output components. queue: bool default `= True` If True, will place the request ...
expand
https://gradio.app/docs/gradio/accordion
Gradio - Accordion Docs
enerators 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 "once" (default for all events except `.change()`) would not allow any submissions while an event is ...
expand
https://gradio.app/docs/gradio/accordion
Gradio - Accordion Docs
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 | tuple[int | str, ...] | None default `= None` A unique key for this event listener to be used i...
expand
https://gradio.app/docs/gradio/accordion
Gradio - Accordion 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....
collapse
https://gradio.app/docs/gradio/accordion
Gradio - Accordion 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....
collapse
https://gradio.app/docs/gradio/accordion
Gradio - Accordion Docs