text stringlengths 0 2k | heading1 stringlengths 3 79 | source_page_url stringclasses 188
values | source_page_title stringclasses 188
values |
|---|---|---|---|
By calling `push_to_hub` or `upload_theme`, the theme assets will be stored in
a [HuggingFace space](https://huggingface.co/docs/hub/spaces-overview).
The theme preview for our seafoam theme is here: [seafoam
preview](https://huggingface.co/spaces/gradio/seafoam).
| Theme Previews | https://gradio.app/docs/gradio/themes | Gradio - Themes Docs |
The [Theme Gallery](https://huggingface.co/spaces/gradio/theme-gallery) shows
all the public gradio themes. After publishing your theme, it will
automatically show up in the theme gallery after a couple of minutes.
You can sort the themes by the number of likes on the space and from most to
least recently created as w... | Discovering Themes | https://gradio.app/docs/gradio/themes | Gradio - Themes Docs |
To use a theme from the hub, use the `from_hub` method on the `ThemeClass` and
pass it to your app:
my_theme = gr.Theme.from_hub("gradio/seafoam")
with gr.Blocks(theme=my_theme) as demo:
....
You can also pass the theme string directly to `Blocks` or `Interface`
(`gr.Blocks(theme="gradi... | Downloading | https://gradio.app/docs/gradio/themes | Gradio - Themes Docs |
The gr.EditData class is a subclass of gr.Event data that specifically
carries information about the `.edit()` event. When gr.EditData is added as a
type hint to an argument of an event listener method, a gr.EditData object
will automatically be passed as the value of that argument. The attributes of
this object contai... | Description | https://gradio.app/docs/gradio/editdata | Gradio - Editdata Docs |
import gradio as gr
def edit(edit_data: gr.EditData, history: list[gr.MessageDict]):
history_up_to_edit = history[:edit_data.index]
history_up_to_edit[-1] = edit_data.value
return history_up_to_edit
with gr.Blocks() as demo:
chatbot = gr.Chatbot()
chatbot.undo(e... | Example Usage | https://gradio.app/docs/gradio/editdata | Gradio - Editdata Docs |
Parameters ▼
index: int | tuple[int, int]
The index of the message that was edited.
previous_value: Any
The previous content of the message that was edited.
value: Any
The new content of the message that was edited.
[Chatbot Specific Events](../../guides/chatbot-speci... | Attributes | https://gradio.app/docs/gradio/editdata | Gradio - Editdata 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 |
Row is a layout element within Blocks that renders all children
horizontally.
| Description | https://gradio.app/docs/gradio/row | Gradio - Row Docs |
with gr.Blocks() as demo:
with gr.Row():
gr.Image("lion.jpg", scale=2)
gr.Image("tiger.jpg", scale=1)
demo.launch()
| Example Usage | https://gradio.app/docs/gradio/row | Gradio - Row Docs |
Parameters ▼
variant: Literal['default', 'panel', 'compact']
default `= "default"`
row type, 'default' (no background), 'panel' (gray background color and
rounded corners), or 'compact' (rounded corners and no internal gap).
visible: bool | Literal['hidden']
default `= True`
If False... | Initialization | https://gradio.app/docs/gradio/row | Gradio - Row Docs |
is
smaller than `max_height`.
min_height: int | str | None
default `= None`
The minimum height of the row, specified in pixels if a number is passed, or
in CSS units if a string is passed. If content exceeds the height, the row
will expand to fit the content. Will not have any effect if `height` is s... | Initialization | https://gradio.app/docs/gradio/row | Gradio - Row Docs |
The widths of elements in a `Row` can be controlled via a combination of
`scale` and `min_width` arguments that are present in every component.
* `scale` is an integer that defines how an element will take up space in a `Row`. If `scale` is set to 0, the element will not expand to take up space. If `scale` is set to... | Controlling Width | https://gradio.app/docs/gradio/row | Gradio - Row 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 |
A TabbedInterface is created by providing a list of Interfaces or Blocks,
each of which gets rendered in a separate tab. Only the components from the
Interface/Blocks will be rendered in the tab.
| Description | https://gradio.app/docs/gradio/tabbedinterface | Gradio - Tabbedinterface Docs |
Parameters ▼
interface_list: list[Blocks]
A list of Interfaces (or Blocks) to be rendered in the tabs.
tab_names: list[str] | None
default `= None`
A list of tab names. If None, the tab names will be "Tab 1", "Tab 2", etc.
title: str | None
default `= None`
The tab t... | Initialization | https://gradio.app/docs/gradio/tabbedinterface | Gradio - Tabbedinterface Docs |
tabbed_interface_lite
| Demos | https://gradio.app/docs/gradio/tabbedinterface | Gradio - Tabbedinterface Docs |
Creates a plot component to display various kinds of plots (matplotlib,
plotly, altair, or bokeh plots are supported). As this component does not
accept user input, it is rarely used as an input component.
| Description | https://gradio.app/docs/gradio/plot | Gradio - Plot Docs |
**Using Plot as an input component.**
How Plot will pass its value to your function:
Type: `PlotData | None`
(Rarely used) passes the data displayed in the plot as an PlotData dataclass,
which includes the plot information as a JSON string, as well as the type of
chart and the plotting library.
Example Code
... | Behavior | https://gradio.app/docs/gradio/plot | Gradio - Plot Docs |
Parameters ▼
value: Any | None
default `= None`
Optionally, supply a default plot object to display, must be a matplotlib,
plotly, altair, or bokeh figure, or a callable. If a function is provided, the
function will be called each time the app loads to set the initial value of
this component.
... | Initialization | https://gradio.app/docs/gradio/plot | Gradio - Plot Docs |
o 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 than
min_width, the min_width parameter will be respected first... | Initialization | https://gradio.app/docs/gradio/plot | Gradio - Plot Docs |
constructor.
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/plot | Gradio - Plot Docs |
Shortcuts
gradio.Plot
Interface String Shortcut `"plot"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/plot | Gradio - Plot Docs |
blocks_kinematicsstock_forecast
| Demos | https://gradio.app/docs/gradio/plot | Gradio - Plot 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 Plot component supports the following e... | Event Listeners | https://gradio.app/docs/gradio/plot | Gradio - Plot Docs |
PI 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_description: str | None | Literal[False]
default `= None`
Description of the API endpoint. Can be a ... | Event Listeners | https://gradio.app/docs/gradio/plot | Gradio - Plot Docs |
he function is then
*required* to return a tuple of lists (even if there is only 1 output
component), with each list in the tuple corresponding to one output component.
max_batch_size: int
default `= 4`
Maximum number of inputs to batch together if this is called from the queue
(only relevant if batch... | Event Listeners | https://gradio.app/docs/gradio/plot | Gradio - Plot Docs |
output components.
concurrency_limit: int | None | Literal['default']
default `= "default"`
If set, this is the maximum 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" t... | Event Listeners | https://gradio.app/docs/gradio/plot | Gradio - Plot Docs |
ould return a
`gr.validate()` for each input value.
[Plot Component For Maps](../../guides/plot-component-for-maps/)
| Event Listeners | https://gradio.app/docs/gradio/plot | Gradio - Plot Docs |
This component displays a table of value spreadsheet-like component. Can be
used to display data as an output component, or as an input to collect data
from the user.
| Description | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
**Using Dataframe as an input component.**
How Dataframe will pass its value to your function:
Type: `pd.DataFrame | np.ndarray | pl.DataFrame | list[list]`
Passes the uploaded spreadsheet data as a `pandas.DataFrame`, `numpy.array`,
`polars.DataFrame`, or native 2D Python `list[list]` depending on `type`.
Example ... | Behavior | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
Parameters ▼
value: pd.DataFrame | Styler | np.ndarray | pl.DataFrame | list | list[list] | dict | str | Callable | None
default `= None`
Default value to display in the DataFrame. Supports pandas, numpy, polars, and
list of lists. If a Styler is provided, it will be used to set the displayed
value in... | Initialization | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
t can be created in the dataframe via the UI. If the first element is None,
there is no minimum number of columns. If the second element is None, there is
no maximum number of columns. Only applies if `interactive` is True.
datatype: Literal['str', 'number', 'bool', 'date', 'markdown', 'html', 'image', ... | Initialization | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
e the component and is also used as
the header if there are a table of examples for this component. If None and
used in a `gr.Interface`, the label will be the name of the parameter this
component is assigned to.
show_label: bool | None
default `= None`
if True, will display label.
eve... | Initialization | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
used to
display data. If not provided, 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 exi... | Initialization | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
nd based on
the cell contents and the table may need to be horizontally scrolled. If
`column_width` is set, then any overflow text will be hidden.
line_breaks: bool
default `= True`
If True (default), will enable Github-flavored Markdown line breaks in chatbot
messages. If False, single new lines will... | Initialization | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
pinned_columns: int | None
default `= None`
If provided, will pin the specified number of columns from the left.
static_columns: list[int] | None
default `= None`
List of column indices (int) that should not be editable. Only applies when
interactive=True. When specified, col_count is aut... | Initialization | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
Shortcuts
gradio.Dataframe
Interface String Shortcut `"dataframe"`
Initialization Uses default values
gradio.Numpy
Interface String Shortcut `"numpy"`
Initialization Uses type="numpy"
gradio.Matrix
Interface String Shortcut `"matrix"`
Initialization Uses type="array"
... | Shortcuts | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
filter_recordsmatrix_transposetax_calculatorsort_records
| Demos | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe 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 Dataframe component supports the follow... | Event Listeners | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
nent.
inputs: Component | BlockContext | list[Component | BlockContext] | Set[Component | BlockContext] | 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 ... | Event Listeners | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
on. If None,
will show the progress animation on all of the output components.
queue: bool
default `= 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 sett... | Event Listeners | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
, 'multiple', 'always_last'] | None
default `= None`
If "once" (default for all events except `.change()`) would 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 ... | Event Listeners | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
very: float
default `= 0.5`
key: int | str | tuple[int | 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
defa... | Event Listeners | https://gradio.app/docs/gradio/dataframe | Gradio - Dataframe Docs |
Creates a color picker for user to select a color as string input. Can be
used as an input to pass a color value to a function or as an output to
display a color value.
| Description | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
**Using ColorPicker as an input component.**
How ColorPicker will pass its value to your function:
Type: `str | None`
Passes selected color value as a hex `str` into the function.
Example Code
import gradio as gr
def predict(
value: str | None
):
... | Behavior | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
Parameters ▼
value: str | Callable | None
default `= None`
default color hex code to provide in color picker. If a function is provided,
the function will be called each time the app loads to set the initial value
of this component.
label: str | I18nData | None
default `= None`
the l... | Initialization | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
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 than
min_width, the min_width parameter will be respected firs... | Initialization | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
ender()
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/colorpicker | Gradio - Colorpicker Docs |
Shortcuts
gradio.ColorPicker
Interface String Shortcut `"colorpicker"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
color_picker
| Demos | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker 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 ColorPicker component supports the foll... | Event Listeners | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
ing to one output component.
inputs: Component | BlockContext | list[Component | BlockContext] | Set[Component | BlockContext] | 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 | BlockCo... | Event Listeners | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
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 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, ... | Event Listeners | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
er_mode: Literal['once', 'multiple', 'always_last'] | None
default `= None`
If "once" (default for all events except `.change()`) would 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()`... | Event Listeners | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker Docs |
stream_every: float
default `= 0.5`
key: int | str | tuple[int | 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... | Event Listeners | https://gradio.app/docs/gradio/colorpicker | Gradio - Colorpicker 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 |
ts: 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 plot... | 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 u... | 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 |
an empty list.
api_name: str | None
default `= None`
defines how the endpoint appears in the API docs. Can be a string or None. If
set to a string, the 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.
... | Event Listeners | https://gradio.app/docs/gradio/barplot | Gradio - Barplot Docs |
of input values for each parameter. The lists should be
of equal length (and be up to length `max_batch_size`). The function is then
*required* to return a tuple of lists (even if there is only 1 output
component), with each list in the tuple corresponding to one output component.
max_batch_size: int
d... | Event Listeners | https://gradio.app/docs/gradio/barplot | Gradio - Barplot Docs |
g 'fn'. Input arguments for js
method are values of 'inputs' and 'outputs', return should be a list of values
for output components.
concurrency_limit: int | None | Literal['default']
default `= "default"`
If set, this is the maximum number of this event that can be running
simultaneously. Can be set ... | Event Listeners | https://gradio.app/docs/gradio/barplot | Gradio - Barplot Docs |
successfully will the main function be called. The validator
receives the same inputs as the main function and should return a
`gr.validate()` for each input value.
[Creating Plots](../../guides/creating-plots/)[Time Plots](../../guides/time-
plots/)
| Event Listeners | https://gradio.app/docs/gradio/barplot | Gradio - Barplot 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 |
ts: 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 plot... | 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 u... | 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 |
be an empty list.
api_name: str | None
default `= None`
defines how the endpoint appears in the API docs. Can be a string or None. If
set to a string, the 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.
... | Event Listeners | https://gradio.app/docs/gradio/lineplot | Gradio - Lineplot Docs |
st of input values for each parameter. The lists should be
of equal length (and be up to length `max_batch_size`). The function is then
*required* to return a tuple of lists (even if there is only 1 output
component), with each list in the tuple corresponding to one output component.
max_batch_size: int... | Event Listeners | https://gradio.app/docs/gradio/lineplot | Gradio - Lineplot Docs |
ning 'fn'. Input arguments for js
method are values of 'inputs' and 'outputs', return should be a list of values
for output components.
concurrency_limit: int | None | Literal['default']
default `= "default"`
If set, this is the maximum number of this event that can be running
simultaneously. Can be s... | Event Listeners | https://gradio.app/docs/gradio/lineplot | Gradio - Lineplot Docs |
es successfully will the main function be called. The validator
receives the same inputs as the main function and should return a
`gr.validate()` for each input value.
[Creating Plots](../../guides/creating-plots/)[Connecting To A
Database](../../guides/connecting-to-a-database/)
| Event Listeners | https://gradio.app/docs/gradio/lineplot | Gradio - Lineplot Docs |
Any code in a `if gr.NO_RELOAD` code-block will not be re-evaluated when
the source file is reloaded. This is helpful for importing modules that do not
like to be reloaded (tiktoken, numpy) as well as database connections and long
running set up code.
| Description | https://gradio.app/docs/gradio/NO_RELOAD | Gradio - No_Reload Docs |
import gradio as gr
if gr.NO_RELOAD:
from transformers import pipeline
pipe = pipeline("text-classification", model="cardiffnlp/twitter-roberta-base-sentiment-latest")
gr.Interface.from_pipeline(pipe).launch()
| Example Usage | https://gradio.app/docs/gradio/NO_RELOAD | Gradio - No_Reload Docs |
Creates a "Sign In" button that redirects the user to sign in with Hugging
Face OAuth. Once the user is signed in, the button will act as a logout
button, and you can retrieve a signed-in user's profile by adding a parameter
of type `gr.OAuthProfile` to any Gradio function. This will only work if this
Gradio app is run... | Description | https://gradio.app/docs/gradio/loginbutton | Gradio - Loginbutton Docs |
**Using LoginButton as an input component.**
How LoginButton will pass its value to your function:
Type: `str | None`
(Rarely used) the `str` corresponding to the button label when the button is
clicked
Example Code
import gradio as gr
def predict(
value: str | N... | Behavior | https://gradio.app/docs/gradio/loginbutton | Gradio - Loginbutton Docs |
Parameters ▼
value: str
default `= "Sign in with Hugging Face"`
logout_value: str
default `= "Logout ({})"`
The text to display when the user is signed in. The string should contain a
placeholder for the username with a call-to-action to logout, e.g. "Logout
({})".
eve... | Initialization | https://gradio.app/docs/gradio/loginbutton | Gradio - Loginbutton Docs |
Shortcuts
gradio.LoginButton
Interface String Shortcut `"loginbutton"`
Initialization Uses default values
| Shortcuts | https://gradio.app/docs/gradio/loginbutton | Gradio - Loginbutton Docs |
login_with_huggingface
| Demos | https://gradio.app/docs/gradio/loginbutton | Gradio - Loginbutton Docs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.