Dataset Viewer
Auto-converted to Parquet Duplicate
text
stringlengths
0
2k
heading1
stringlengths
3
79
source_page_url
stringclasses
189 values
source_page_title
stringclasses
189 values
`gradio-rs` is a Gradio Client in Rust built by [@JacobLinCool](https://github.com/JacobLinCool). You can find the repo [here](https://github.com/JacobLinCool/gradio-rs), and more in depth API documentation [here](https://docs.rs/gradio/latest/gradio/).
Introduction
https://gradio.app/docs/third-party-clients/rust-client
Third Party Clients - Rust Client Docs
Here is an example of using BS-RoFormer model to separate vocals and background music from an audio file. use gradio::{PredictionInput, Client, ClientOptions}; [tokio::main] async fn main() { if std::env::args().len() < 2 { println!("Please provide an audio file path as a...
Usage
https://gradio.app/docs/third-party-clients/rust-client
Third Party Clients - Rust Client Docs
cargo install gradio gr --help Take [stabilityai/stable- diffusion-3-medium](https://huggingface.co/spaces/stabilityai/stable- diffusion-3-medium) HF Space as an example: > gr list stabilityai/stable-diffusion-3-medium API Spec for stabilityai/stable-diffusion-3-medium: /infer ...
Command Line Interface
https://gradio.app/docs/third-party-clients/rust-client
Third Party Clients - Rust Client Docs
Gradio applications support programmatic requests from many environments: * The [Python Client](/docs/python-client): `gradio-client` allows you to make requests from Python environments. * The [JavaScript Client](/docs/js-client): `@gradio/client` allows you to make requests in TypeScript from the browser or serv...
Gradio Clients
https://gradio.app/docs/third-party-clients/introduction
Third Party Clients - Introduction Docs
We also encourage the development and use of third party clients built by the community: * [Rust Client](/docs/third-party-clients/rust-client): `gradio-rs` built by [@JacobLinCool](https://github.com/JacobLinCool) allows you to make requests in Rust. * [Powershell Client](https://github.com/rrg92/powershai): `pow...
Community Clients
https://gradio.app/docs/third-party-clients/introduction
Third Party Clients - Introduction Docs
ZeroGPU ZeroGPU spaces are rate-limited to ensure that a single user does not hog all of the available GPUs. The limit is controlled by a special token that the Hugging Face Hub infrastructure adds to all incoming requests to Spaces. This token is a request header called `X-IP-Token` and its value changes depending on...
Explaining Rate Limits for
https://gradio.app/docs/python-client/using-zero-gpu-spaces
Python Client - Using Zero Gpu Spaces Docs
Token In the following hypothetical example, when a user presses enter in the textbox, the `generate()` function is called, which calls a second function, `text_to_image()`. Because the Gradio Client is being instantiated indirectly, in `text_to_image()`, we will need to extract their token from the `X-IP- Token` head...
Avoiding Rate Limits by Manually Passing an IP
https://gradio.app/docs/python-client/using-zero-gpu-spaces
Python Client - Using Zero Gpu Spaces Docs
The main Client class for the Python client. This class is used to connect to a remote Gradio app and call its API endpoints.
Description
https://gradio.app/docs/python-client/client
Python Client - Client Docs
from gradio_client import Client client = Client("abidlabs/whisper-large-v2") connecting to a Hugging Face Space client.predict("test.mp4", api_name="/predict") >> What a nice recording! returns the result of the remote API call client = Client("https://bec81a83-5b5c-471e.gradio.live") conne...
Example usage
https://gradio.app/docs/python-client/client
Python Client - Client Docs
Parameters โ–ผ src: str either the name of the Hugging Face Space to load, (e.g. "abidlabs/whisper- large-v2") or the full URL (including "http" or "https") of the hosted Gradio app to load (e.g. "http://mydomain.com/app" or "https://bec81a83-5b5c-471e.gradio.live/"). token: str | None d...
Initialization
https://gradio.app/docs/python-client/client
Python Client - Client Docs
n the remote machine instead. ssl_verify: bool default `= True` if False, skips certificate validation which allows the client to connect to Gradio apps that are using self-signed certificates. analytics_enabled: bool default `= True` Whether to allow basic telemetry. If None, will u...
Initialization
https://gradio.app/docs/python-client/client
Python Client - Client 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 Client component supports the following...
Event Listeners
https://gradio.app/docs/python-client/client
Python Client - Client Docs
eters. For hardware upgrades (beyond the basic CPU tier), you may be required to provide billing information on Hugging Face: <https://huggingface.co/settings/billing> <br> Event Parameters Parameters โ–ผ args: <class 'inspect._empty'> The positional arguments to pass to the remote API endpoint. The or...
Event Listeners
https://gradio.app/docs/python-client/client
Python Client - Client Docs
**Stream From a Gradio app in 5 lines** Use the `submit` method to get a job you can iterate over. In python: from gradio_client import Client client = Client("gradio/llm_stream") for result in client.submit("What's the best UI framework in Python?"): print(result) ...
Ergonomic API ๐Ÿ’†
https://gradio.app/docs/python-client/version-1-release
Python Client - Version 1 Release Docs
Anything you can do in the UI, you can do with the client: * ๐Ÿ”Authentication * ๐Ÿ›‘ Job Cancelling * โ„น๏ธ Access Queue Position and API * ๐Ÿ“• View the API information Here's an example showing how to display the queue position of a pending job: from gradio_client import Client client = ...
Transparent Design ๐ŸชŸ
https://gradio.app/docs/python-client/version-1-release
Python Client - Version 1 Release Docs
The client can run from pretty much any python and javascript environment (node, deno, the browser, Service Workers). Here's an example using the client from a Flask server using gevent: from gevent import monkey monkey.patch_all() from gradio_client import Client from flask import Fla...
Portable Design โ›บ๏ธ
https://gradio.app/docs/python-client/version-1-release
Python Client - Version 1 Release Docs
Changes **Python** * The `serialize` argument of the `Client` class was removed and has no effect. * The `upload_files` argument of the `Client` was removed. * All filepaths must be wrapped in the `handle_file` method. For example, `caption = client.predict(handle_file('./dog.jpg'))`. * The `output_dir` a...
v1.0 Migration Guide and Breaking
https://gradio.app/docs/python-client/version-1-release
Python Client - Version 1 Release Docs
A Job is a wrapper over the Future class that represents a prediction call that has been submitted by the Gradio client. This class is not meant to be instantiated directly, but rather is created by the Client.submit() method. A Job object includes methods to get the status of the prediction call, as well to get the ...
Description
https://gradio.app/docs/python-client/job
Python Client - Job Docs
Parameters โ–ผ future: Future The future object that represents the prediction call, created by the Client.submit() method communicator: Communicator | None default `= None` The communicator object that is used to communicate between the client and the background thread running the job ...
Initialization
https://gradio.app/docs/python-client/job
Python Client - Job 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 Job component supports the following ev...
Event Listeners
https://gradio.app/docs/python-client/job
Python Client - Job Docs
If you already have a recent version of `gradio`, then the `gradio_client` is included as a dependency. But note that this documentation reflects the latest version of the `gradio_client`, so upgrade if youโ€™re not sure! The lightweight `gradio_client` package can be installed from pip (or pip3) and is tested to work w...
Installation
https://gradio.app/docs/python-client/introduction
Python Client - Introduction Docs
Spaces Start by connecting instantiating a `Client` object and connecting it to a Gradio app that is running on Hugging Face Spaces. from gradio_client import Client client = Client("abidlabs/en2fr") a Space that translates from English to French You can also connect to private Spaces by pass...
Connecting to a Gradio App on Hugging Face
https://gradio.app/docs/python-client/introduction
Python Client - Introduction Docs
use While you can use any public Space as an API, you may get rate limited by Hugging Face if you make too many requests. For unlimited usage of a Space, simply duplicate the Space to create a private Space, and then use it to make as many requests as youโ€™d like! The `gradio_client` includes a class method: `Client.d...
Duplicating a Space for private
https://gradio.app/docs/python-client/introduction
Python Client - Introduction Docs
app If your app is running somewhere else, just provide the full URL instead, including the โ€œhttp://โ€ or โ€œhttps://โ€œ. Hereโ€™s an example of making predictions to a Gradio app that is running on a share URL: from gradio_client import Client client = Client("https://bec81a83-5b5c-471e.gradio.live")...
Connecting a general Gradio
https://gradio.app/docs/python-client/introduction
Python Client - Introduction Docs
Once you have connected to a Gradio app, you can view the APIs that are available to you by calling the `Client.view_api()` method. For the Whisper Space, we see the following: Client.predict() Usage Info --------------------------- Named API endpoints: 1 - predict(audio, api_name="/pre...
Inspecting the API endpoints
https://gradio.app/docs/python-client/introduction
Python Client - Introduction Docs
As an alternative to running the `.view_api()` method, you can click on the โ€œUse via APIโ€ link in the footer of the Gradio app, which shows us the same information, along with example usage. ![](https://huggingface.co/datasets/huggingface/documentation- images/resolve/main/gradio-guides/view-api.png) The View API pag...
The โ€œView APIโ€ Page
https://gradio.app/docs/python-client/introduction
Python Client - Introduction Docs
The simplest way to make a prediction is simply to call the `.predict()` function with the appropriate arguments: from gradio_client import Client client = Client("abidlabs/en2fr", api_name='/predict') client.predict("Hello") >> Bonjour If there are multiple parameters, then you sh...
Making a prediction
https://gradio.app/docs/python-client/introduction
Python Client - Introduction Docs
to the Gradio server and ensures that the file is preprocessed correctly: from gradio_client import Client, file client = Client("abidlabs/whisper") client.predict( audio=file("https://audio-samples.github.io/samples/mp3/blizzard_unconditional/sample-0.mp3") ) >> "My th...
Making a prediction
https://gradio.app/docs/python-client/introduction
Python Client - Introduction Docs
Oe should note that `.predict()` is a _blocking_ operation as it waits for the operation to complete before returning the prediction. In many cases, you may be better off letting the job run in the background until you need the results of the prediction. You can do this by creating a `Job` instance using the `.submit(...
Running jobs asynchronously
https://gradio.app/docs/python-client/introduction
Python Client - Introduction Docs
Alternatively, one can add one or more callbacks to perform actions after the job has completed running, like this: from gradio_client import Client def print_result(x): print("The translated result is: {x}") client = Client(space="abidlabs/en2fr") job = client.submit("...
Adding callbacks
https://gradio.app/docs/python-client/introduction
Python Client - Introduction Docs
The `Job` object also allows you to get the status of the running job by calling the `.status()` method. This returns a `StatusUpdate` object with the following attributes: `code` (the status code, one of a set of defined strings representing the status. See the `utils.Status` class), `rank` (the current position of th...
Status
https://gradio.app/docs/python-client/introduction
Python Client - Introduction Docs
The `Job` class also has a `.cancel()` instance method that cancels jobs that have been queued but not started. For example, if you run: client = Client("abidlabs/whisper") job1 = client.submit(file("audio_sample1.wav")) job2 = client.submit(file("audio_sample2.wav")) job1.cancel() will retu...
Cancelling Jobs
https://gradio.app/docs/python-client/introduction
Python Client - Introduction Docs
Some Gradio API endpoints do not return a single value, rather they return a series of values. You can get the series of values that have been returned at any time from such a generator endpoint by running `job.outputs()`: from gradio_client import Client client = Client(src="gradio/count_genera...
Generator Endpoints
https://gradio.app/docs/python-client/introduction
Python Client - Introduction Docs
Gradio demos can include [session state](https://www.gradio.app/guides/state- in-blocks), which provides a way for demos to persist information from user interactions within a page session. For example, consider the following demo, which maintains a list of words that a user has submitted in a `gr.State` component. Wh...
Demos with Session State
https://gradio.app/docs/python-client/introduction
Python Client - Introduction 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
Creates a bar plot component to display data from a pandas DataFrame.
Description
https://gradio.app/docs/gradio/barplot
Gradio - Barplot Docs
**Using BarPlot as an input component.** How BarPlot will pass its value to your function: Type: `PlotData | None` The data to display in a line plot. Example Code import gradio as gr def predict( value: PlotData | None ): process value from t...
Behavior
https://gradio.app/docs/gradio/barplot
Gradio - Barplot Docs
Parameters โ–ผ value: pd.DataFrame | Callable | None default `= None` The pandas dataframe containing the data to display in the plot. x: str | None default `= None` Column corresponding to the x axis. Column can be numeric, datetime, or string/category. y: str | None ...
Initialization
https://gradio.app/docs/gradio/barplot
Gradio - Barplot Docs
ne` List containing column names of the series to show in the legend. By default, all series are shown. x_lim: list[float | None] | None default `= None` A tuple or list containing the limits for the x-axis, specified as [x_min, x_max]. To fix only one of these values, set the other to None, e.g. [0,...
Initialization
https://gradio.app/docs/gradio/barplot
Gradio - Barplot Docs
", "-x", "-y", or list of strings that represent the order of the categories. tooltip: Literal['axis', 'none', 'all'] | list[str] default `= "axis"` The tooltip to display when hovering on a point. "axis" shows the values for the axis columns, "all" shows all column values, and "none" shows no tooltip...
Initialization
https://gradio.app/docs/gradio/barplot
Gradio - Barplot Docs
uts: Component | list[Component] | Set[Component] | None default `= None` Components that are used as inputs to calculate `value` if `value` is a function (has no effect otherwise). `value` is recalculated any time the inputs change. visible: bool | Literal['hidden'] default `= True` Whether the plo...
Initialization
https://gradio.app/docs/gradio/barplot
Gradio - Barplot Docs
-render. preserved_by_key: list[str] | str | None default `= "value"` A list of parameters from this component's constructor. Inside a gr.render() function, if a component is re-rendered with the same key, these (and only these) parameters will be preserved in the UI (if they have been changed by the ...
Initialization
https://gradio.app/docs/gradio/barplot
Gradio - Barplot Docs
`gr.LinePlot`, `gr.ScatterPlot`, and `gr.BarPlot` all share the same API. Here is a summary of the most important features. For full details and live demos, see the [Creating Plots](/guides/creating-plots) and [Time Plots](/guides/time-plots) guides. **Basic Usage with a DataFrame** Pass a `pd.DataFrame` as the value...
Key Concepts
https://gradio.app/docs/gradio/barplot
Gradio - Barplot Docs
ection: gr.SelectData): return gr.BarPlot(x_lim=[selection.index[0], selection.index[1]]) plot.double_click(lambda: gr.BarPlot(x_lim=None), outputs=plot) **Realtime Data** Use `gr.Timer` to keep plots updated with live data. You can attach the timer via `every`, or wire it up manually: ...
Key Concepts
https://gradio.app/docs/gradio/barplot
Gradio - Barplot Docs
Shortcuts gradio.BarPlot Interface String Shortcut `"barplot"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/barplot
Gradio - Barplot Docs
bar_plot_demo
Demos
https://gradio.app/docs/gradio/barplot
Gradio - Barplot 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 BarPlot component supports the followin...
Event Listeners
https://gradio.app/docs/gradio/barplot
Gradio - Barplot Docs
nents to use as inputs. If the function takes no inputs, this should be an empty list. outputs: Component | BlockContext | list[Component | BlockContext] | Set[Component | BlockContext] | None default `= None` List of gradio.components to use as outputs. If the function returns no outputs, this should...
Event Listeners
https://gradio.app/docs/gradio/barplot
Gradio - Barplot Docs
queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app. batch: bool default `= False` If True, then the function should process a batch of inputs, meaning that it should accept a li...
Event Listeners
https://gradio.app/docs/gradio/barplot
Gradio - Barplot Docs
. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` and `.key_up()` events) would allow a second submission after the pending event is complete. js: str | Literal[True] | None default `= None` Optional frontend js method to run before run...
Event Listeners
https://gradio.app/docs/gradio/barplot
Gradio - Barplot Docs
ender(). If set, this value identifies an event as identical across re-renders when the key is identical. validator: Callable | None default `= None` Optional validation function to run before the main function. If provided, this function will be executed first with queue=False, and only if it complet...
Event Listeners
https://gradio.app/docs/gradio/barplot
Gradio - Barplot Docs
Creates a code editor for viewing code (as an output component), or for entering and editing code (as an input component).
Description
https://gradio.app/docs/gradio/code
Gradio - Code Docs
**Using Code as an input component.** How Code will pass its value to your function: Type: `str | None` Passes the code entered as a `str`. Example Code import gradio as gr def predict( value: str | None ): process value from the Code componen...
Behavior
https://gradio.app/docs/gradio/code
Gradio - Code Docs
Parameters โ–ผ value: str | Callable | None default `= None` Default value to show in the code editor. If a function is provided, the function will be called each time the app loads to set the initial value of this component. language: Literal['python', 'c', 'cpp', 'markdown', 'latex', '...
Initialization
https://gradio.app/docs/gradio/code
Gradio - Code Docs
s component is assigned to. interactive: bool | None default `= None` Whether user should be able to enter code or only view it. show_label: bool | None default `= None` if True, will display label. container: bool default `= True` If True, will place the component ...
Initialization
https://gradio.app/docs/gradio/code
Gradio - Code Docs
key: int | str | tuple[int | str, ...] | None default `= None` in a gr.render, Components with the same key across re-renders are treated as the same component, not a new component. Properties set in 'preserved_by_key' are not reset across a re-render. preserved_by_key: list[str] | str | None default...
Initialization
https://gradio.app/docs/gradio/code
Gradio - Code Docs
Shortcuts gradio.Code Interface String Shortcut `"code"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/code
Gradio - Code 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 Code component supports the following e...
Event Listeners
https://gradio.app/docs/gradio/code
Gradio - Code 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
as a pathlib.Path to a css file or a list of such paths. This css files will be read, concatenated, and included in the demo webpage. If the `css` parameter is also set, the css from `css` will be included first. js: str | Literal[True] | None default `= None` Custom js as a code string. The js code ...
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
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
336

Models trained or fine-tuned on gradio/docs

Spaces using gradio/docs 2