text
stringlengths
0
2k
heading1
stringlengths
3
79
source_page_url
stringclasses
188 values
source_page_title
stringclasses
188 values
Mount a gradio.Blocks to an existing FastAPI application.
Description
https://gradio.app/docs/gradio/mount_gradio_app
Gradio - Mount_Gradio_App Docs
from fastapi import FastAPI import gradio as gr app = FastAPI() @app.get("/") def read_main(): return {"message": "This is your main app"} io = gr.Interface(lambda x: "Hello, " + x + "!", "textbox", "textbox") app = gr.mount_gradio_app(app, io, path="/gradio") Then run `uvicorn run:app`...
Example Usage
https://gradio.app/docs/gradio/mount_gradio_app
Gradio - Mount_Gradio_App Docs
Parameters ▼ app: fastapi.FastAPI The parent FastAPI application. blocks: gradio.Blocks The blocks object we want to mount to the parent app. path: str The path at which the gradio application will be mounted, e.g. "/gradio". server_name: str default `...
Initialization
https://gradio.app/docs/gradio/mount_gradio_app
Gradio - Mount_Gradio_App Docs
ic request, that user is not authorized to access the gradio app (they will see a 401 Unauthorized response). To be used with external authentication systems like OAuth. Cannot be used with `auth`. root_path: str | None default `= None` The subpath corresponding to the public deployment of this FastAP...
Initialization
https://gradio.app/docs/gradio/mount_gradio_app
Gradio - Mount_Gradio_App Docs
browser console log. Otherwise, errors will only be visible in the terminal session running the Gradio app. max_file_size: str | int | None default `= None` The maximum file size in bytes that can be uploaded. Can be a string of the form "<value><unit>", where value is any positive integer and unit is...
Initialization
https://gradio.app/docs/gradio/mount_gradio_app
Gradio - Mount_Gradio_App Docs
or will attempt to load a theme from the Hugging Face Hub (e.g. "gradio/monochrome"). If None, will use the Default theme. css: str | None default `= None` Custom css as a code string. This css will be included in the demo webpage. css_paths: str | Path | list[str | Path] | None defa...
Initialization
https://gradio.app/docs/gradio/mount_gradio_app
Gradio - Mount_Gradio_App 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
None | Literal[False] default `= None` Description of the API endpoint. Can be a string, None, or False. If set to a string, the endpoint will be exposed in the API docs with the given description. If None, the function's docstring will be used as the API endpoint description. If False, then no description will be d...
Event Listeners
https://gradio.app/docs/gradio/button
Gradio - Button Docs
of inputs to batch together if this is called from the queue (only relevant if batch=True) preprocess: bool default `= True` If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component). ...
Event Listeners
https://gradio.app/docs/gradio/button
Gradio - Button Docs
y_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default). concurrency_id: str | None default `= None` If set, this is the id of the co...
Event Listeners
https://gradio.app/docs/gradio/button
Gradio - Button Docs
This function allows you to pass custom warning messages to the user. You can do so simply by writing `gr.Warning('message here')` in your function, and when that line is executed the custom message will appear in a modal on the demo. The modal is yellow by default and has the heading: "Warning." Queue must be enabled ...
Description
https://gradio.app/docs/gradio/warning
Gradio - Warning Docs
import gradio as gr def hello_world(): gr.Warning('This is a warning message.') return "hello world" with gr.Blocks() as demo: md = gr.Markdown() demo.load(hello_world, inputs=None, outputs=[md]) demo.queue().launch()
Example Usage
https://gradio.app/docs/gradio/warning
Gradio - Warning Docs
Parameters ▼ message: str default `= "Warning issued."` The warning message to be displayed to the user. Can be HTML, which will be rendered in the modal. duration: float | None default `= 10` The duration in seconds that the warning message should be displayed for. If None or 0, the...
Initialization
https://gradio.app/docs/gradio/warning
Gradio - Warning Docs
blocks_chained_events [Alerts](../../guides/alerts)
Demos
https://gradio.app/docs/gradio/warning
Gradio - Warning Docs
This class allows you to pass custom error messages to the user. You can do so by raising a gr.Error("custom message") anywhere in the code, and when that line is executed the custom message will appear in a modal on the demo. You can control for how long the error message is displayed with the `duration` parameter. I...
Description
https://gradio.app/docs/gradio/error
Gradio - Error Docs
import gradio as gr def divide(numerator, denominator): if denominator == 0: raise gr.Error("Cannot divide by zero!") gr.Interface(divide, ["number", "number"], "number").launch()
Example Usage
https://gradio.app/docs/gradio/error
Gradio - Error Docs
Parameters ▼ message: str default `= "Error raised."` The error message to be displayed to the user. Can be HTML, which will be rendered in the modal. duration: float | None default `= 10` The duration in seconds to display the error message. If None or 0, the error message will be d...
Initialization
https://gradio.app/docs/gradio/error
Gradio - Error Docs
calculatorblocks_chained_events [Alerts](../../guides/alerts/)
Demos
https://gradio.app/docs/gradio/error
Gradio - Error Docs
Decorator that auto-caches function results based on content-hashed inputs. Works with sync/async functions and sync/async generators. For generators, all yielded values are cached and replayed on hit. Cache hits bypass the Gradio queue.
Description
https://gradio.app/docs/gradio/cache
Gradio - Cache Docs
import gradio as gr @gr.cache def classify(image): return model.predict(image) @gr.cache(max_size=256, per_session=True) def generate(prompt): return llm(prompt)
Example Usage
https://gradio.app/docs/gradio/cache
Gradio - Cache Docs
Parameters ▼ fn: Callable | None default `= None` The function to cache. When used as @gr.cache without parentheses, this is the decorated function. When used as @gr.cache(...), this is None. key: Callable | None default `= None` Optional function that receives the kwargs dict and re...
Initialization
https://gradio.app/docs/gradio/cache
Gradio - Cache Docs
The Progress class provides a custom progress tracker that is used in a function signature. To attach a Progress tracker to a function, simply add a parameter right after the input parameters that has a default value set to a `gradio.Progress()` instance. The Progress tracker can then be updated in the function by call...
Description
https://gradio.app/docs/gradio/progress
Gradio - Progress Docs
import gradio as gr import time def my_function(x, progress=gr.Progress()): progress(0, desc="Starting...") time.sleep(1) for i in progress.tqdm(range(100)): time.sleep(0.1) return x gr.Interface(my_function, gr.Textbox(), gr.Textbox()).queue().launch()
Example Usage
https://gradio.app/docs/gradio/progress
Gradio - Progress Docs
Parameters ▼ track_tqdm: bool default `= False` If True, the Progress object will track any tqdm.tqdm iterations with the tqdm library in the function.
Initialization
https://gradio.app/docs/gradio/progress
Gradio - Progress Docs
Methods
https://gradio.app/docs/gradio/progress
Gradio - Progress 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....
__call__
https://gradio.app/docs/gradio/progress
Gradio - Progress Docs
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.%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...
__call__
https://gradio.app/docs/gradio/progress
Gradio - Progress Docs
None if unknown. If None, hides progress bar. desc: str | None default `= None` description to display. total: int | float | None default `= None` estimated total number of steps. unit: str default `= "steps"` unit of iterations.
__call__
https://gradio.app/docs/gradio/progress
Gradio - Progress 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....
tqdm
https://gradio.app/docs/gradio/progress
Gradio - Progress Docs
2'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%2...
tqdm
https://gradio.app/docs/gradio/progress
Gradio - Progress Docs
total number of steps. unit: str default `= "steps"` unit of iterations. [Progress Bars](../../guides/progress-bars/)
tqdm
https://gradio.app/docs/gradio/progress
Gradio - Progress 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....
__call__
https://gradio.app/docs/gradio/progress
Gradio - Progress Docs
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.%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...
__call__
https://gradio.app/docs/gradio/progress
Gradio - Progress Docs
None if unknown. If None, hides progress bar. desc: str | None default `= None` description to display. total: int | float | None default `= None` estimated total number of steps. unit: str default `= "steps"` unit of iterations.
__call__
https://gradio.app/docs/gradio/progress
Gradio - Progress 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....
tqdm
https://gradio.app/docs/gradio/progress
Gradio - Progress Docs
2'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%2...
tqdm
https://gradio.app/docs/gradio/progress
Gradio - Progress Docs
total number of steps. unit: str default `= "steps"` unit of iterations.
tqdm
https://gradio.app/docs/gradio/progress
Gradio - Progress Docs
Interface is Gradio's main high-level class, and allows you to create a web-based GUI / demo around a machine learning model (or any Python function) in a few lines of code. You must specify three parameters: (1) the function to create a GUI for (2) the desired input components and (3) the desired output components. Ad...
Description
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
import gradio as gr def image_classifier(inp): return {'cat': 0.3, 'dog': 0.7} demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label") demo.launch()
Example Usage
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
Parameters ▼ fn: Callable the function to wrap an interface around. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding t...
Initialization
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
If True, caches examples in the server for fast runtime in examples. If "lazy", then examples are cached (for all users of the app) after their first use (by any user of the app). If None, will use the GRADIO_CACHE_EXAMPLES environment variable, which should be either "true" or "false". In HuggingFace Spaces, this pa...
Initialization
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
tically rerun if any of the inputs change. title: str | I18nData | None default `= None` a title for the interface; if provided, appears above the input and output components in large font. Also used as the tab title when opened in a browser window. description: str | None default `= ...
Initialization
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
s ["X", "Y"], in which case the values will be the list of strings and the labels will ["Flag as X", "Flag as Y"], etc. flagging_dir: str default `= ".gradio/flagged"` path to the directory where flagged data is stored. If the directory does not exist, it will be created. flagging_call...
Initialization
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
None` defines how the prediction endpoint appears in the API docs. Can be a string or None. If set to a string, the endpoint will be exposed in the API docs with the given name. If None, the name of the function will be used. api_description: str | None | Literal[False] default `= None` Description ...
Initialization
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
an be provided as well to configure other properties of the container holding the additional inputs. Defaults to a `gr.Accordion(label="Additional Inputs", open=False)`. This parameter is only used if `additional_inputs` is provided. submit_btn: str | Button default `= "Submit"` the button to use for ...
Initialization
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
'minimal', 'hidden'] default `= "full"` how to show the progress animation while event is running: "full" shows a spinner which covers the output component area as well as a runtime display in the upper right corner, "minimal" only shows the runtime display, "hidden" shows no progress animation at all ...
Initialization
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
hello_worldhello_world_2hello_world_3
Demos
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
Methods
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
![](data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='%23808080'%20viewBox='0%200%20640%20512'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc....
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
2'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%2...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
pp inline in an iframe. Defaults to True in python notebooks; False otherwise. inbrowser: bool default `= False` whether to automatically launch the gradio app in a new tab on the default browser. share: bool | None default `= None` whether to create a publicly shareable link for the...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
an alert modal and printed in the browser console log. They will also be displayed in the alert modal of downstream apps that gr.load() this app. server_name: str | None default `= None` to make app accessible on local network, set this to "0.0.0.0". Can be set by environment variable GRADIO_SERVER_NA...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
inks: list[Literal['api', 'gradio', 'settings'] | 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" corresponding to the API docs, "built with Gradio", and settings pages respectively. If ...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
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 argument values. For example, `{"docs_url": "/docs"}` state_sessi...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
] | 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 response). To be used with external authentication systems like OAuth. Cannot be ...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
vironment 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 enabled if this Gradio app is launched on Spaces, but not otherwise. ...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
ly 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 be used to add custom meta tags, multiple scripts, stylesheets, etc. to the page....
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
![](data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='%23808080'%20viewBox='0%200%20640%20512'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc....
load
https://gradio.app/docs/gradio/interface
Gradio - Interface 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%203...
load
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component. inputs: Component | BlockContext | list[Component | BlockContext] | Set[Compo...
load
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
shows the runtime display, "hidden" shows no progress animation at all show_progress_on: Component | list[Component] | None default `= None` Component or list of components to show the progress animation on. If None, will show the progress animation on all of the output components. que...
load
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
ponents .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 `.c...
load
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
nted" (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...
load
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
![](data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='%23808080'%20viewBox='0%200%20640%20512'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc....
from_pipeline
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
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.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5...
from_pipeline
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
/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.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%207...
from_pipeline
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
ne object to use.
from_pipeline
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
![](data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='%23808080'%20viewBox='0%200%20640%20512'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc....
integrate
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
e%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...
integrate
https://gradio.app/docs/gradio/interface
Gradio - Interface 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/interface
Gradio - Interface Docs
![](data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='%23808080'%20viewBox='0%200%20640%20512'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc....
queue
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%2...
queue
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
ro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%20318.3L391.3%20319.9C381%...
queue
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
send status at regular intervals set by this parameter as the number of seconds. api_open: bool | None default `= None` If True, the REST routes of the backend will be open, allowing requests made directly to those endpoints to skip the queue. max_size: int | None default `= None` T...
queue
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
![](data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='%23808080'%20viewBox='0%200%20640%20512'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc....
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%20392.4%...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
2'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5%20260.8%2...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
pp inline in an iframe. Defaults to True in python notebooks; False otherwise. inbrowser: bool default `= False` whether to automatically launch the gradio app in a new tab on the default browser. share: bool | None default `= None` whether to create a publicly shareable link for the...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
an alert modal and printed in the browser console log. They will also be displayed in the alert modal of downstream apps that gr.load() this app. server_name: str | None default `= None` to make app accessible on local network, set this to "0.0.0.0". Can be set by environment variable GRADIO_SERVER_NA...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
inks: list[Literal['api', 'gradio', 'settings'] | 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" corresponding to the API docs, "built with Gradio", and settings pages respectively. If ...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
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 argument values. For example, `{"docs_url": "/docs"}` state_sessi...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
] | 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 response). To be used with external authentication systems like OAuth. Cannot be ...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
vironment 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 enabled if this Gradio app is launched on Spaces, but not otherwise. ...
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
ly 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 be used to add custom meta tags, multiple scripts, stylesheets, etc. to the page....
launch
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
![](data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='%23808080'%20viewBox='0%200%20640%20512'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc....
load
https://gradio.app/docs/gradio/interface
Gradio - Interface 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%203...
load
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component. inputs: Component | BlockContext | list[Component | BlockContext] | Set[Compo...
load
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
shows the runtime display, "hidden" shows no progress animation at all show_progress_on: Component | list[Component] | None default `= None` Component or list of components to show the progress animation on. If None, will show the progress animation on all of the output components. que...
load
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
ponents .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 `.c...
load
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
nted" (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...
load
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
![](data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='%23808080'%20viewBox='0%200%20640%20512'%3e%3c!--!%20Font%20Awesome%20Pro%206.0.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license%20\(Commercial%20License\)%20Copyright%202022%20Fonticons,%20Inc....
from_pipeline
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
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.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%2075.51%20376.1%20131.1C426.1%20181.1%20433.5...
from_pipeline
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs
/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.%20--%3e%3cpath%20d='M172.5%20131.1C228.1%2075.51%20320.5%207...
from_pipeline
https://gradio.app/docs/gradio/interface
Gradio - Interface Docs