Dataset Viewer
Auto-converted to Parquet Duplicate
text
stringlengths
0
2k
heading1
stringlengths
3
79
source_page_url
stringclasses
185 values
source_page_title
stringclasses
185 values
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
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
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
`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
Load a chat interface from an OpenAI API chat compatible endpoint.
Description
https://gradio.app/docs/gradio/load_chat
Gradio - Load_Chat Docs
import gradio as gr demo = gr.load_chat("http://localhost:11434/v1", model="deepseek-r1") demo.launch()
Example Usage
https://gradio.app/docs/gradio/load_chat
Gradio - Load_Chat Docs
Parameters โ–ผ base_url: str The base URL of the endpoint, e.g. "http://localhost:11434/v1/" model: str The name of the model you are loading, e.g. "llama3.2" token: str | None default `= None` The API token or a placeholder string if you are using a local model, e.g. "...
Initialization
https://gradio.app/docs/gradio/load_chat
Gradio - Load_Chat Docs
Set the static paths to be served by the gradio app. Static files are are served directly from the file system instead of being copied. They are served to users with The Content-Disposition HTTP header set to "inline" when sending these files to users. This indicates that the file should be displayed directly in the ...
Description
https://gradio.app/docs/gradio/set_static_paths
Gradio - Set_Static_Paths Docs
import gradio as gr Paths can be a list of strings or pathlib.Path objects corresponding to filenames or directories. gr.set_static_paths(paths=["test/test_files/"]) The example files and the default value of the input will not be copied to the gradio cache and will be served directly. ...
Example Usage
https://gradio.app/docs/gradio/set_static_paths
Gradio - Set_Static_Paths Docs
Parameters โ–ผ paths: str | pathlib.Path | list[str | pathlib.Path] filepath or list of filepaths or directory names to be served by the gradio app. If it is a directory name, ALL files located within that directory will be considered static and not moved to the gradio cache. This also means that ALL fil...
Initialization
https://gradio.app/docs/gradio/set_static_paths
Gradio - Set_Static_Paths Docs
A Gradio request object that can be used to access the request headers, cookies, query parameters and other information about the request from within the prediction function. The class is a thin wrapper around the fastapi.Request class. Attributes of this class include: `headers`, `client`, `query_params`, `session_has...
Description
https://gradio.app/docs/gradio/request
Gradio - Request Docs
import gradio as gr def echo(text, request: gr.Request): if request: print("Request headers dictionary:", request.headers) print("IP address:", request.client.host) print("Query parameters:", dict(request.query_params)) print("Session hash:", request.session_h...
Example Usage
https://gradio.app/docs/gradio/request
Gradio - Request Docs
Parameters โ–ผ request: fastapi.Request | None default `= None` A fastapi.Request username: str | None default `= None` The username of the logged in user (if auth is enabled) session_hash: str | None default `= None` The session hash of the current session. It is uni...
Initialization
https://gradio.app/docs/gradio/request
Gradio - Request Docs
request_ip_headers
Demos
https://gradio.app/docs/gradio/request
Gradio - Request Docs
Creates a file explorer component that allows users to browse files on the machine hosting the Gradio app. As an input component, it also allows users to select files to be used as input to a function, while as an output component, it displays selected files.
Description
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
**Using FileExplorer as an input component.** How FileExplorer will pass its value to your function: Type: `list[str] | str | None` Passes the selected file or directory as a `str` path (relative to `root`) or `list[str}` depending on `file_count` Example Code import gradio as gr ...
Behavior
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
Parameters โ–ผ glob: str default `= "**/*"` The glob-style pattern used to select which files to display, e.g. "*" to match all files, "*.png" to match all .png files, "**/*.txt" to match any .txt file in any subdirectory, etc. The default value matches all files and folders recursively. See the Python ...
Initialization
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
onent. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to. every: Timer | float | None default `= None` Continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `va...
Initialization
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
min_height: int | str | None default `= None` interactive: bool | None default `= None` if True, will allow users to select file(s); if False, will only display files. If not provided, this is inferred based on whether the component is used as an input or output. visib...
Initialization
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
buttons: list[Button] | None default `= None` A list of gr.Button() instances to show in the top right corner of the component. Custom buttons will appear in the toolbar with their configured icon and/or label, and clicking them will trigger any .click() events registered on the button.
Initialization
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
Shortcuts gradio.FileExplorer Interface String Shortcut `"fileexplorer"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer 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 FileExplorer component supports the fol...
Event Listeners
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
text] | None default `= None` List of gradio.components 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 outp...
Event Listeners
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
lt `= True` If True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app. batch: bool default `= False` If True, then the function should process a...
Event Listeners
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
not allow any submissions while an event is pending. 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 `= ...
Event Listeners
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
ique key for this event listener to be used in @gr.render(). If set, this value identifies an event as identical across re-renders when the key is identical. validator: Callable | None default `= None` Optional validation function to run before the main function. If provided, this function will be exe...
Event Listeners
https://gradio.app/docs/gradio/fileexplorer
Gradio - Fileexplorer Docs
Creates a chatbot that displays user-submitted messages and responses. Supports a subset of Markdown including bold, italics, code, tables. Also supports audio/video/image files, which are displayed in the Chatbot, and other kinds of files which are displayed as links. This component is usually used as an output compon...
Description
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
The Chatbot component accepts a list of messages, where each message is a dictionary with `role` and `content` keys. This format is compatible with the message format expected by most LLM APIs (OpenAI, Claude, HuggingChat, etc.), making it easy to pipe model outputs directly into the component. The `role` key should b...
Behavior
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
Parameters โ–ผ value: list[MessageDict | Message] | Callable | None default `= None` Default list of messages to show in chatbot, where each message is of the format {"role": "user", "content": "Help me."}. Role can be one of "user", "assistant", or "system". Content should be either text, or media pass...
Initialization
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
ide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True. min_width: int default `= 160` minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower tha...
Initialization
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
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 user or an event listener) instead of re-rendered based on the values provided during constructor....
Initialization
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
pen delimiter (str), "right": close delimiter (str), "display": whether to display in newline (bool)} that will be used to render LaTeX expressions. If not provided, `latex_delimiters` is set to `[{ "left": "$$", "right": "$$", "display": True }]`, so only expressions enclosed in $$ delimiters will be rendered as LaTeX...
Initialization
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
rder). Pass None for either the user or bot image to skip. Must be within the working directory of the Gradio app or an external URL. sanitize_html: bool default `= True` If False, will disable HTML sanitization for chatbot messages. This is not recommended, as it can lead to security vulnerabilities....
Initialization
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
ered vertically and horizontally in the Chatbot. Supports Markdown and HTML. If None, no placeholder is displayed. examples: list[ExampleMessage] | None default `= None` A list of example messages to display in the chatbot before any user/assistant messages are shown. Each example should be a dictiona...
Initialization
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
and displayed in a separate collapsible message with metadata={"title": "Reasoning"}. For example, [("<thinking>", "</thinking>")] will extract content between <thinking> and </thinking> tags. Each thinking block will be displayed as a separate collapsible message before the main response. If None (default), no automat...
Initialization
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
Shortcuts gradio.Chatbot Interface String Shortcut `"chatbot"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
**Displaying Thoughts/Tool Usage** You can provide additional metadata regarding any tools used to generate the response. This is useful for displaying the thought process of LLM agents. For example, def generate_response(history): history.append( ChatMessage(role="assistant", ...
Examples
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
deo("https://github.com/gradio-app/gradio/raw/main/gradio/media_assets/videos/world.mp4")} ] with gr.Blocks() as demo: chatbot = gr.Chatbot() button = gr.Button("Load audio and video") button.click(load, None, chatbot) demo.launch()
Examples
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
chatbot_simplechatbot_streamingchatbot_with_toolschatbot_core_components
Demos
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot 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 Chatbot component supports the followin...
Event Listeners
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
s event has SelectData of type gradio.SelectData that carries information, accessible through SelectData.index and SelectData.value. See SelectData documentation on how to use this event data. Chatbot.option_select(fn, ยทยทยท) This listener is triggered when the user clicks on an option from within the Cha...
Event Listeners
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
ckContext] | Set[Component | BlockContext] | None default `= None` List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list. api_name: str | None default `= None` defines how the endpoint appears in the API docs. Can be a string or None. If set to...
Event Listeners
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
f the gradio app. batch: bool default `= False` If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a ...
Event Listeners
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
d submission after the pending event is complete. js: str | Literal[True] | None default `= None` Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components. concurr...
Event Listeners
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
= None` Optional validation function to run before the main function. If provided, this function will be executed first with queue=False, and only if it completes successfully will the main function be called. The validator receives the same inputs as the main function and should return a `gr.validate()` for each inpu...
Event Listeners
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
Helper Classes
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
gradio.ChatMessage(ยทยทยท) Description A dataclass that represents a message in the Chatbot component (with type="messages"). The only required field is `content`. The value of `gr.Chatbot` is a list of these dataclasses. Parameters โ–ผ content: MessageContent | list[MessageContent] The content of the me...
ChatMessage
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
A typed dictionary to represent metadata for a message in the Chatbot component. An instance of this dictionary is used for the `metadata` field in a ChatMessage when the chat message should be displayed as a thought. Keys โ–ผ title: str The title of the 'thought' message. Only required field. ...
MetadataDict
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
A typed dictionary to represent an option in a ChatMessage. A list of these dictionaries is used for the `options` field in a ChatMessage. Keys โ–ผ value: str The value to return when the option is selected. label: str The text to display in the option, if different from the value. [Ch...
OptionDict
https://gradio.app/docs/gradio/chatbot
Gradio - Chatbot Docs
The gr.KeyUpData class is a subclass of gr.EventData that specifically carries information about the `.key_up()` event. When gr.KeyUpData is added as a type hint to an argument of an event listener method, a gr.KeyUpData object will automatically be passed as the value of that argument. The attributes of this object co...
Description
https://gradio.app/docs/gradio/keyupdata
Gradio - Keyupdata Docs
import gradio as gr def test(value, key_up_data: gr.KeyUpData): return { "component value": value, "input value": key_up_data.input_value, "key": key_up_data.key } with gr.Blocks() as demo: d = gr.Dropdown(["abc", "def"], allow_custom_value=T...
Example Usage
https://gradio.app/docs/gradio/keyupdata
Gradio - Keyupdata Docs
Parameters โ–ผ key: str The key that was pressed. input_value: str The displayed value in the input textbox after the key was pressed. This may be different than the `value` attribute of the component itself, as the `value` attribute of some components (e.g. Dropdown) are not updated unt...
Attributes
https://gradio.app/docs/gradio/keyupdata
Gradio - Keyupdata Docs
dropdown_key_up
Demos
https://gradio.app/docs/gradio/keyupdata
Gradio - Keyupdata Docs
The gr.CopyData class is a subclass of gr.EventData that specifically carries information about the `.copy()` event. When gr.CopyData is added as a type hint to an argument of an event listener method, a gr.CopyData object will automatically be passed as the value of that argument. The attributes of this object contain...
Description
https://gradio.app/docs/gradio/copydata
Gradio - Copydata Docs
import gradio as gr def on_copy(copy_data: gr.CopyData): return f"Copied text: {copy_data.value}" with gr.Blocks() as demo: textbox = gr.Textbox("Hello World!") copied = gr.Textbox() textbox.copy(on_copy, None, copied) demo.launch()
Example Usage
https://gradio.app/docs/gradio/copydata
Gradio - Copydata Docs
Parameters โ–ผ value: Any The value that was copied.
Attributes
https://gradio.app/docs/gradio/copydata
Gradio - Copydata Docs
Creates an image component that can be used to upload images (as an input) or display images (as an output).
Description
https://gradio.app/docs/gradio/image
Gradio - Image Docs
**Using Image as an input component.** How Image will pass its value to your function: Type: `np.ndarray | PIL.Image.Image | str | None` Passes the uploaded image as a `numpy.array`, `PIL.Image` or `str` filepath depending on `type`. Example Code import gradio as gr def pred...
Behavior
https://gradio.app/docs/gradio/image
Gradio - Image Docs
Parameters โ–ผ value: str | PIL.Image.Image | np.ndarray | Callable | None default `= None` A `PIL.Image`, `numpy.array`, `pathlib.Path`, or `str` filepath or URL for the default value that Image component is going to take. If a function is provided, the function will be called each time the app loads t...
Initialization
https://gradio.app/docs/gradio/image
Gradio - Image Docs
erred from the image file type (e.g. "RGBA" for a .png image, "RGB" in most other cases). sources: list[Literal['upload', 'webcam', 'clipboard']] | Literal['upload', 'webcam', 'clipboard'] | None default `= None` List of sources for the image. "upload" creates a box where user can drop an image file, ...
Initialization
https://gradio.app/docs/gradio/image
Gradio - Image Docs
calculate `value` if `value` is a function (has no effect otherwise). `value` is recalculated any time the inputs change. show_label: bool | None default `= None` if True, will display label. buttons: list[Literal['download', 'share', 'fullscreen'] | Button] | None default `= None` ...
Initialization
https://gradio.app/docs/gradio/image
Gradio - Image Docs
ovided, this is inferred based on whether the component is used as an input or output. visible: bool | Literal['hidden'] default `= True` If False, component will be hidden. If "hidden", component will be visually hidden and not take up space in the layout but still exist in the DOM st...
Initialization
https://gradio.app/docs/gradio/image
Gradio - Image Docs
s provided during constructor. webcam_options: WebcamOptions | None default `= None` placeholder: str | None default `= None` Custom text for the upload area. Overrides default upload messages when provided. Accepts new lines and `` to designate a heading. watermark: W...
Initialization
https://gradio.app/docs/gradio/image
Gradio - Image Docs
Shortcuts gradio.Image Interface String Shortcut `"image"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/image
Gradio - Image Docs
The `type` parameter controls the format of the data passed to your Python function. Choosing the right type avoids unnecessary conversions in your code: `type`| Your function receives| Shape / Format| Best for ---|---|---|--- `"numpy"` (default)| `numpy.ndarray`| `(height, width, 3)`, dtype `uint8`, values 0โ€“255|...
Understanding Image Types
https://gradio.app/docs/gradio/image
Gradio - Image Docs
The `gr.Image` component can process or display any image format that is [supported by the PIL library](https://pillow.readthedocs.io/en/stable/handbook/image-file- formats.html), including animated GIFs. In addition, it also supports the SVG image format. When the `gr.Image` component is used as an input component, t...
`GIF` and `SVG` Image Formats
https://gradio.app/docs/gradio/image
Gradio - Image Docs
sepia_filterfake_diffusion
Demos
https://gradio.app/docs/gradio/image
Gradio - Image 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 Image component supports the following ...
Event Listeners
https://gradio.app/docs/gradio/image
Gradio - Image Docs
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 | BlockContext] | None default `= None` List o...
Event Listeners
https://gradio.app/docs/gradio/image
Gradio - Image Docs
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: bool default `= True` If True, will place the r...
Event Listeners
https://gradio.app/docs/gradio/image
Gradio - Image Docs
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
249

Models trained or fine-tuned on gradio/docs

Spaces using gradio/docs 2