text
stringlengths
0
2k
heading1
stringlengths
3
79
source_page_url
stringclasses
188 values
source_page_title
stringclasses
188 values
hello_worlddiff_textssentence_builder
Demos
https://gradio.app/docs/gradio/textbox
Gradio - Textbox 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 Textbox component supports the followin...
Event Listeners
https://gradio.app/docs/gradio/textbox
Gradio - Textbox Docs
t data gradio.CopyData to carry information about the copied content. 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...
Event Listeners
https://gradio.app/docs/gradio/textbox
Gradio - Textbox Docs
True, will scroll to output component on 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, "m...
Event Listeners
https://gradio.app/docs/gradio/textbox
Gradio - Textbox Docs
ent data before returning 'fn' output to 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 o...
Event Listeners
https://gradio.app/docs/gradio/textbox
Gradio - Textbox Docs
oncurrency_limit. api_visibility: 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),...
Event Listeners
https://gradio.app/docs/gradio/textbox
Gradio - Textbox 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
ChatInterface is Gradio's high-level abstraction for creating chatbot UIs, and allows you to create a web-based demo around a chatbot model in a few lines of code. Only one parameter is required: fn, which takes a function that governs the response of the chatbot based on the user input and chat history. Additional par...
Description
https://gradio.app/docs/gradio/chatinterface
Gradio - Chatinterface Docs
**Basic Example** : A chatbot that echoes back the users’s message import gradio as gr def echo(message, history): return message demo = gr.ChatInterface(fn=echo, examples=["hello", "hola", "merhaba"], title="Echo Bot") demo.launch() **Custom Chatbot** : A `gr.ChatInterface...
Example Usage
https://gradio.app/docs/gradio/chatinterface
Gradio - Chatinterface Docs
Parameters ▼ fn: Callable the function to wrap the chat interface around. The function should accept two parameters: a `str` representing the input message and `list` of openai-style dictionaries: {"role": "user" | "assistant", "content": `str` | {"path": `str`} | `gr.Component`} representing the chat ...
Initialization
https://gradio.app/docs/gradio/chatinterface
Gradio - Chatinterface Docs
cks, then the components will be displayed under the chatbot, in an accordion. The values of these components will be passed into `fn` as arguments in order after the chat history. additional_inputs_accordion: str | Accordion | None default `= None` if a string is provided, this is the label of the `g...
Initialization
https://gradio.app/docs/gradio/chatinterface
Gradio - Chatinterface Docs
atbot. example_labels: list[str] | None default `= None` labels for the examples, to be displayed instead of the examples themselves. If provided, should be a list of strings with the same length as the examples list. Only applies when examples are displayed within the chatbot (i.e. when `additional_i...
Initialization
https://gradio.app/docs/gradio/chatinterface
Gradio - Chatinterface Docs
None` a title for the interface; if provided, appears above chatbot in large font. Also used as the tab title when opened in a browser window. description: str | None default `= None` a description for the interface; if provided, appears above the chatbot and beneath the title in regular font. Accept...
Initialization
https://gradio.app/docs/gradio/chatinterface
Gradio - Chatinterface Docs
tton with a submit icon within the textbox. If a string, will use that string as the submit button text in place of the icon. If False, will not show a submit button. stop_btn: str | bool | None default `= True` If True, will show a button with a stop icon during generator executions, to stop generati...
Initialization
https://gradio.app/docs/gradio/chatinterface
Gradio - Chatinterface Docs
hat interface will expand to the height of window. fill_width: bool default `= False` Whether to horizontally expand to fill container fully. If False, centers and constrains app to a maximum width. api_name: str | None default `= None` defines how the chat endpoint appears in the AP...
Initialization
https://gradio.app/docs/gradio/chatinterface
Gradio - Chatinterface Docs
chatinterface_random_responsechatinterface_streaming_echochatinterface_artifacts [Creating A Chatbot Fast](../../guides/creating-a-chatbot-fast/)[Chatinterface Examples](../../guides/chatinterface-examples/)[Agents And Tool Usage](../../guides/agents-and-tool-usage/)[Chatbot Specific Events](../../guides/chatbot-speci...
Demos
https://gradio.app/docs/gradio/chatinterface
Gradio - Chatinterface Docs
Blocks is Gradio's low-level API that allows you to create more custom web applications and demos than Interfaces (yet still entirely in Python). Compared to the Interface class, Blocks offers more flexibility and control over: (1) the layout of components (2) the events that trigger the execution of functions (3)...
Description
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
import gradio as gr def update(name): return f"Welcome to Gradio, {name}!" with gr.Blocks() as demo: gr.Markdown("Start typing below and then click **Run** to see the output.") with gr.Row(): inp = gr.Textbox(placeholder="What is your name?") out = gr.Textbox...
Example Usage
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
Parameters ▼ analytics_enabled: bool | None default `= None` Whether to allow basic telemetry. If None, will use GRADIO_ANALYTICS_ENABLED environment variable or default to True. mode: str default `= "blocks"` A human-friendly name for the kind of Blocks or Interface being created. U...
Initialization
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
blocks_helloblocks_flipperblocks_kinematics
Demos
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
Methods
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
![](data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='%23808080'%20viewBox='0%200%20640%20512'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc....
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks 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%203...
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%2039...
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
inline: bool | None default `= None` whether to display in the gradio app inline in an iframe. Defaults to True in python notebooks; False otherwise. inbrowser: bool default `= False` whether to automatically launch the gradio app in a new tab on the default browser. share: bo...
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
default `= False` If True, any errors in the gradio app will be displayed in an alert modal and printed in the browser console log. They will also be displayed in the alert modal of downstream apps that gr.load() this app. server_name: str | None default `= None` to make app accessible on local net...
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
t `= False` If True, suppresses most print statements. footer_links: list[Literal['api', 'gradio', 'settings'] | dict[str, str]] | None default `= None` The links to display in the footer of the app. Accepts a list, where each element of the list must be one of "api", "gradio", or "settings" correspo...
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
ps:// can be provided, which will be used as the root path in its entirety. Can be set by environment variable GRADIO_ROOT_PATH. Defaults to "". app_kwargs: dict[str, Any] | None default `= None` Additional keyword arguments to pass to the underlying FastAPI app as a dictionary of parameter keys and a...
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
nsecure. auth_dependency: Callable[[fastapi.Request], str | None] | None default `= None` A function that takes a FastAPI request and returns a string user ID or None. If the function returns None for a specific request, that user is not authorized to access the app (they will see a 401 Unauthorized r...
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
rendered using client-side rendering mode. If None, will use GRADIO_SSR_MODE environment variable or default to False. pwa: bool | None default `= None` If True, the Gradio app will be set up as an installable PWA (Progressive Web App). If set to None (default behavior), then the PWA feature will be ...
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
None default `= None` Custom js as a code string. The js code will automatically be executed when the page loads. For more flexibility, use the head parameter to insert js inside <script> tags. head: str | None default `= None` Custom html code to insert into the head of the demo webpage. This can b...
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks 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/blocks
Gradio - Blocks 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%2031...
queue
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
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%203...
queue
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
will send status estimations to all clients whenever a job is finished. Otherwise Queue will 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...
queue
https://gradio.app/docs/gradio/blocks
Gradio - Blocks 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....
integrate
https://gradio.app/docs/gradio/blocks
Gradio - Blocks 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%...
integrate
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
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/blocks
Gradio - Blocks 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....
load
https://gradio.app/docs/gradio/blocks
Gradio - Blocks 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....
load
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
ction 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[Component | BlockContext] | Set[Component |...
load
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
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 output components. queue: bo...
load
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
s .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 "once" (default for all events except `.change(...
load
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
(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 | tuple[int | str, ...] | None default `= No...
load
https://gradio.app/docs/gradio/blocks
Gradio - Blocks 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....
unload
https://gradio.app/docs/gradio/blocks
Gradio - Blocks 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.4...
unload
https://gradio.app/docs/gradio/blocks
Gradio - Blocks 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...
unload
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
ources. The function should not take any arguments and the output is not used. [Blocks And Event Listeners](../../guides/blocks-and-event- listeners/)[Controlling Layout](../../guides/controlling-layout/)[State In Blocks](../../guides/state-in-blocks/)[More Blocks Features](../../guides/more-blocks-features/)
unload
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
![](data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='%23808080'%20viewBox='0%200%20640%20512'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc....
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks 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%203...
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%2039...
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
inline: bool | None default `= None` whether to display in the gradio app inline in an iframe. Defaults to True in python notebooks; False otherwise. inbrowser: bool default `= False` whether to automatically launch the gradio app in a new tab on the default browser. share: bo...
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
default `= False` If True, any errors in the gradio app will be displayed in an alert modal and printed in the browser console log. They will also be displayed in the alert modal of downstream apps that gr.load() this app. server_name: str | None default `= None` to make app accessible on local net...
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
t `= False` If True, suppresses most print statements. footer_links: list[Literal['api', 'gradio', 'settings'] | dict[str, str]] | None default `= None` The links to display in the footer of the app. Accepts a list, where each element of the list must be one of "api", "gradio", or "settings" correspo...
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
ps:// can be provided, which will be used as the root path in its entirety. Can be set by environment variable GRADIO_ROOT_PATH. Defaults to "". app_kwargs: dict[str, Any] | None default `= None` Additional keyword arguments to pass to the underlying FastAPI app as a dictionary of parameter keys and a...
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
nsecure. auth_dependency: Callable[[fastapi.Request], str | None] | None default `= None` A function that takes a FastAPI request and returns a string user ID or None. If the function returns None for a specific request, that user is not authorized to access the app (they will see a 401 Unauthorized r...
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
rendered using client-side rendering mode. If None, will use GRADIO_SSR_MODE environment variable or default to False. pwa: bool | None default `= None` If True, the Gradio app will be set up as an installable PWA (Progressive Web App). If set to None (default behavior), then the PWA feature will be ...
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
None default `= None` Custom js as a code string. The js code will automatically be executed when the page loads. For more flexibility, use the head parameter to insert js inside <script> tags. head: str | None default `= None` Custom html code to insert into the head of the demo webpage. This can b...
launch
https://gradio.app/docs/gradio/blocks
Gradio - Blocks 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/blocks
Gradio - Blocks 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%2031...
queue
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
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%203...
queue
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
will send status estimations to all clients whenever a job is finished. Otherwise Queue will 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...
queue
https://gradio.app/docs/gradio/blocks
Gradio - Blocks 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....
integrate
https://gradio.app/docs/gradio/blocks
Gradio - Blocks 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%...
integrate
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
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/blocks
Gradio - Blocks 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....
load
https://gradio.app/docs/gradio/blocks
Gradio - Blocks 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....
load
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
ction 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[Component | BlockContext] | Set[Component |...
load
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
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 output components. queue: bo...
load
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
s .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 "once" (default for all events except `.change(...
load
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
(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 | tuple[int | str, ...] | None default `= No...
load
https://gradio.app/docs/gradio/blocks
Gradio - Blocks 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....
unload
https://gradio.app/docs/gradio/blocks
Gradio - Blocks 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.4...
unload
https://gradio.app/docs/gradio/blocks
Gradio - Blocks 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...
unload
https://gradio.app/docs/gradio/blocks
Gradio - Blocks Docs
ources. The function should not take any arguments and the output is not used.
unload
https://gradio.app/docs/gradio/blocks
Gradio - Blocks 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