Dataset Viewer
Auto-converted to Parquet Duplicate
text
stringlengths
0
2k
heading1
stringlengths
3
79
source_page_url
stringclasses
190 values
source_page_title
stringclasses
190 values
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 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: The positional arguments to pass to the remote API endpoint. The order of the arguments mus...
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
Sets up an event listener that triggers a function when the specified event(s) occur. This is especially useful when the same function should be triggered by multiple events. Only a single API endpoint is generated for all events in the triggers list.
Description
https://gradio.app/docs/gradio/on
Gradio - On Docs
import gradio as gr with gr.Blocks() as demo: with gr.Row(): input = gr.Textbox() button = gr.Button("Submit") output = gr.Textbox() gr.on( triggers=[button.click, input.submit], fn=lambda x: x, inputs=[input], outp...
Example Usage
https://gradio.app/docs/gradio/on
Gradio - On Docs
Parameters β–Ό triggers: list[Trigger] | Trigger | None default `= None` List of triggers to listen to, e.g. [btn.click, number.change]. If None, will run on app load and changes to any inputs. fn: Callable[..., Any] | None | Literal['decorator'] default `= "decorator"` the function to...
Initialization
https://gradio.app/docs/gradio/on
Gradio - On Docs
api_name: str | None default `= None` defines how the endpoint appears in the API docs. Can be a string or None. If set to a string, the endpoint will be exposed in the API docs with the given name. If None (default), the name of the function will be used as the API endpoint. api_descrip...
Initialization
https://gradio.app/docs/gradio/on
Gradio - On Docs
ault `= 4` Maximum number 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 `Imag...
Initialization
https://gradio.app/docs/gradio/on
Gradio - On Docs
mum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_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 def...
Initialization
https://gradio.app/docs/gradio/on
Gradio - On Docs
Creates a video component that can be used to upload/record videos (as an input) or display videos (as an output). For the video to be playable in the browser it must have a compatible container and codec combination. Allowed combinations are .mp4 with h264 codec, .ogg with theora codec, and .webm with vp9 codec. If th...
Description
https://gradio.app/docs/gradio/video
Gradio - Video Docs
**Using Video as an input component.** How Video will pass its value to your function: Type: `str | None` Passes the uploaded video as a `str` filepath or URL whose extension can be modified by `format`. Example Code import gradio as gr def predict( value: str | ...
Behavior
https://gradio.app/docs/gradio/video
Gradio - Video Docs
Parameters β–Ό value: str | Path | Callable | None default `= None` path or URL for the default value that Video component is going to take. Or can be callable, in which case the function will be called whenever the app loads to set the initial value of the component. format: str | None ...
Initialization
https://gradio.app/docs/gradio/video
Gradio - Video Docs
nd 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` continuously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a floa...
Initialization
https://gradio.app/docs/gradio/video
Gradio - Video Docs
be hidden. If "hidden", component will be visually hidden and not take up space in the layout but still exist in the DOM elem_id: str | None default `= None` an optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles. elem_clas...
Initialization
https://gradio.app/docs/gradio/video
Gradio - Video Docs
ult `= None` whether the component should record/retain the audio track for a video. By default, audio is excluded for webcam videos and included for uploaded videos. autoplay: bool default `= False` whether to automatically play the video when the component is used as an output. Note: browsers will ...
Initialization
https://gradio.app/docs/gradio/video
Gradio - Video Docs
d position on the video. Valid formats for the image are: jpeg, png. subtitles: str | Path | list[dict[str, Any]] | None default `= None` A subtitle file (srt, vtt, or json) for the video, or a list of subtitle dictionaries in the format [{"text": str, "timestamp": [start, end]}] where timestamps are ...
Initialization
https://gradio.app/docs/gradio/video
Gradio - Video Docs
Shortcuts gradio.Video Interface String Shortcut `"video"` Initialization Uses default values gradio.PlayableVideo Interface String Shortcut `"playablevideo"` Initialization Uses format="mp4"
Shortcuts
https://gradio.app/docs/gradio/video
Gradio - Video Docs
video_identity_2
Demos
https://gradio.app/docs/gradio/video
Gradio - Video 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 Video component supports the following ...
Event Listeners
https://gradio.app/docs/gradio/video
Gradio - Video Docs
d when the user changes the value of the Video. Event Parameters Parameters β–Ό fn: Callable | None | Literal['decorator'] default `= "decorator"` the function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one ...
Event Listeners
https://gradio.app/docs/gradio/video
Gradio - Video Docs
s: Literal['full', 'minimal', 'hidden'] default `= "full"` how to show the progress animation while event is running: "full" shows a spinner which covers the output component area as well as a runtime display in the upper right corner, "minimal" only shows the runtime display, "hidden" shows no progress animation at ...
Event Listeners
https://gradio.app/docs/gradio/video
Gradio - Video Docs
ict[str, Any] | list[dict[str, Any]] | None default `= None` A list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generato...
Event Listeners
https://gradio.app/docs/gradio/video
Gradio - Video Docs
st set concurrency_limit. api_visibility: Literal['public', 'private', 'undocumented'] default `= "public"` controls the visibility and accessibility of this endpoint. Can be "public" (shown in API docs and callable by clients), "private" (hidden from API docs and not callable by the Gradio client lib...
Event Listeners
https://gradio.app/docs/gradio/video
Gradio - Video Docs
Helper Classes
https://gradio.app/docs/gradio/video
Gradio - Video Docs
gradio.WebcamOptions(Β·Β·Β·) Description A dataclass for specifying options for the webcam tool in the ImageEditor component. An instance of this class can be passed to the `webcam_options` parameter of `gr.ImageEditor`. Initialization Parameters β–Ό mirror: bool default `= True` If True, the webcam wi...
Webcam Options
https://gradio.app/docs/gradio/video
Gradio - Video Docs
Validates that the audio length is within the specified min and max length (in seconds). You can use this to construct a validator that will check if the user-provided audio is either too short or too long. import gradio as gr demo = gr.Interface( lambda x: x, inputs="video", ...
is_video_correct_length
https://gradio.app/docs/gradio/video
Gradio - Video 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 JavaScript to run before 'f...
Event Listeners
https://gradio.app/docs/gradio/barplot
Gradio - Barplot Docs
...] | None default `= None` A unique 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...
Event Listeners
https://gradio.app/docs/gradio/barplot
Gradio - Barplot Docs
Group is a layout element within Blocks which groups together children so that they do not have any padding or margin between them.
Description
https://gradio.app/docs/gradio/group
Gradio - Group Docs
with gr.Group(): gr.Textbox(label="First") gr.Textbox(label="Last")
Example Usage
https://gradio.app/docs/gradio/group
Gradio - Group Docs
Parameters β–Ό visible: bool | Literal['hidden'] default `= True` If False, group will be hidden. elem_id: str | None default `= None` An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles. elem_classes: li...
Initialization
https://gradio.app/docs/gradio/group
Gradio - Group Docs
Creates a line plot component to display data from a pandas DataFrame.
Description
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
**Using LinePlot as an input component.** How LinePlot 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...
Behavior
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot 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/lineplot
Gradio - Lineplot 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/lineplot
Gradio - Lineplot 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/lineplot
Gradio - Lineplot 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/lineplot
Gradio - Lineplot 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/lineplot
Gradio - Lineplot 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/lineplot
Gradio - Lineplot Docs
ex[0], selection.index[1]]) plot.double_click(lambda: gr.LinePlot(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: def get_data(): return pd.DataFrame(...) fetch latest d...
Key Concepts
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
Shortcuts gradio.LinePlot Interface String Shortcut `"lineplot"` Initialization Uses default values
Shortcuts
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
line_plot_demo
Demos
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot 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 LinePlot component supports the followi...
Event Listeners
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
omponents 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 sh...
Event Listeners
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
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 batch of inputs, meaning that it should accept ...
Event Listeners
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
ding. 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 JavaScript to run befor...
Event Listeners
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot Docs
str, ...] | None default `= None` A unique 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...
Event Listeners
https://gradio.app/docs/gradio/lineplot
Gradio - Lineplot 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
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
450

Models trained or fine-tuned on gradio/docs

Spaces using gradio/docs 2