Python library for easily interacting with trained machine learning models
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Comprehensive set of UI components for handling different data types including text input, media files, form controls, data display, and specialized interfaces for various use cases.
Components for text input, display, and manipulation with support for various text formats and interaction patterns.
class Textbox:
def __init__(
self,
value=None,
lines=1,
max_lines=None,
placeholder=None,
label=None,
info=None,
every=None,
show_label=None,
container=True,
scale=None,
min_width=160,
interactive=None,
visible=True,
elem_id=None,
elem_classes=None,
render=True,
type="text",
text_align=None,
rtl=False,
show_copy_button=False,
autofocus=False,
autoscroll=True,
max_length=None,
**kwargs
):
"""
Text input component for single or multi-line text.
Parameters:
- value: Default text value (None for empty)
- lines: Number of lines (1 for single-line, >1 for multi-line)
- max_lines: Maximum number of lines for auto-expansion (None for unlimited)
- placeholder: Placeholder text
- label: Component label
- info: Additional info text
- type: Input type ("text", "password", "email")
- text_align: Text alignment ("left", "center", "right")
- rtl: Whether to use right-to-left text direction
- show_copy_button: Whether to show copy button
- autofocus: Whether to automatically focus on component
- autoscroll: Whether to automatically scroll to bottom
- max_length: Maximum number of characters allowed
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
def input(self, fn, inputs=None, outputs=None, **kwargs): ...
def focus(self, fn, inputs=None, outputs=None, **kwargs): ...
def blur(self, fn, inputs=None, outputs=None, **kwargs): ...
def submit(self, fn, inputs=None, outputs=None, **kwargs): ...
class MultimodalTextbox:
def __init__(
self,
value="",
lines=1,
max_lines=20,
placeholder=None,
label=None,
info=None,
every=None,
show_label=None,
container=True,
scale=None,
min_width=160,
interactive=None,
visible=True,
elem_id=None,
elem_classes=None,
render=True,
file_types=None,
file_count="multiple",
**kwargs
):
"""
Text input with file attachment support.
Parameters:
- file_types: Allowed file types (list of extensions)
- file_count: Number of files ("single" or "multiple")
"""
# Template aliases
Text = Textbox # Alias for Textbox
TextArea = Textbox # Pre-configured with lines=7Components for displaying and rendering HTML content.
class HTML:
def __init__(
self,
value=None,
label=None,
every=None,
inputs=None,
show_label=False,
visible=True,
elem_id=None,
elem_classes=None,
render=True,
key=None,
preserved_by_key="value",
min_height=None,
max_height=None,
container=False,
padding=True,
autoscroll=False,
**kwargs
):
"""
Displays arbitrary HTML content.
Parameters:
- value: HTML content string or callable
- label: Component label
- show_label: Whether to show the label
- min_height: Minimum height in pixels
- max_height: Maximum height in pixels
- padding: Whether to add padding
- autoscroll: Whether to auto-scroll content
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
def click(self, fn, inputs=None, outputs=None, **kwargs): ...Components for displaying text with highlights and annotations.
class HighlightedText:
def __init__(
self,
value=None,
color_map=None,
show_legend=False,
show_inline_category=True,
combine_adjacent=False,
adjacent_separator="",
label=None,
info=None,
every=None,
inputs=None,
show_label=None,
container=True,
scale=None,
min_width=160,
interactive=None,
visible=True,
elem_id=None,
elem_classes=None,
render=True,
key=None,
preserved_by_key="value",
**kwargs
):
"""
Displays text with highlighted spans by category or confidence.
Parameters:
- value: List of tuples (text, category/confidence) or callable
- color_map: Dictionary mapping categories to colors
- show_legend: Whether to show color legend
- show_inline_category: Show category names inline
- combine_adjacent: Combine adjacent tokens with same category
- adjacent_separator: Separator for combined tokens
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
def select(self, fn, inputs=None, outputs=None, **kwargs): ...
# Template aliases
Highlight = HighlightedText
Highlightedtext = HighlightedText # Case variantComponents for multi-speaker conversation display and input.
class Dialogue:
def __init__(
self,
value=None,
type="text",
speakers=None,
formatter=None,
unformatter=None,
tags=None,
separator="\n",
color_map=None,
label="Dialogue",
info=None,
every=None,
inputs=None,
show_label=None,
container=True,
scale=None,
min_width=160,
interactive=None,
visible=True,
elem_id=None,
elem_classes=None,
render=True,
key=None,
preserved_by_key="value",
**kwargs
):
"""
Component for displaying or collecting multi-speaker conversations.
Parameters:
- value: List of dialogue lines with speaker and text
- type: Output format ("list" or "text")
- speakers: List of speaker names
- formatter: Function to format dialogue output
- unformatter: Function to parse dialogue input
- tags: List of available tags for messages
- separator: Separator for text format
- color_map: Speaker name to color mapping
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
def input(self, fn, inputs=None, outputs=None, **kwargs): ...
def submit(self, fn, inputs=None, outputs=None, **kwargs): ...Components for displaying structured parameter information.
class ParamViewer:
def __init__(
self,
value=None,
language="python",
linkify=None,
every=None,
inputs=None,
render=True,
key=None,
preserved_by_key="value",
header="Parameters",
anchor_links=False,
**kwargs
):
"""
Displays interactive parameter table with syntax highlighting.
Parameters:
- value: Dictionary of parameter definitions
- language: Programming language for syntax ("python" or "typescript")
- linkify: List of strings to convert to links
- header: Table header text
- anchor_links: Whether to create anchor links
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
def upload(self, fn, inputs=None, outputs=None, **kwargs): ...Usage examples:
# Single-line text input
name_input = gr.Textbox(label="Name", placeholder="Enter your name")
# Multi-line text area
description = gr.Textbox(lines=5, label="Description")
# Multimodal input with file attachments
multimodal = gr.MultimodalTextbox(
label="Message with files",
file_types=[".txt", ".pdf", ".jpg"]
)Interactive button components for triggering actions and user interactions with various styles and specialized functionality.
class Button:
def __init__(
self,
value="Run",
variant="secondary",
size="lg",
icon=None,
link=None,
visible=True,
interactive=True,
elem_id=None,
elem_classes=None,
render=True,
scale=None,
min_width=None,
**kwargs
):
"""
Clickable button component.
Parameters:
- value: Button text/label
- variant: Button style ("primary", "secondary", "stop")
- size: Button size ("sm", "lg")
- icon: Icon name or URL
- link: URL to open when clicked
"""
def click(self, fn, inputs=None, outputs=None, **kwargs): ...
class ClearButton(Button):
def __init__(self, components=None, **kwargs):
"""
Button that clears specified components.
Parameters:
- components: List of components to clear
"""
class DownloadButton(Button):
def __init__(self, label="Download", **kwargs):
"""Button for downloading files."""
class UploadButton(Button):
def __init__(
self,
label="Upload a File",
file_types=None,
file_count="single",
**kwargs
):
"""
Button for uploading files.
Parameters:
- file_types: Allowed file types
- file_count: "single" or "multiple"
"""
class DuplicateButton(Button):
def __init__(self, **kwargs):
"""Button for duplicating Hugging Face Spaces."""
class LoginButton(Button):
def __init__(self, **kwargs):
"""OAuth login button."""
class DeepLinkButton(Button):
def __init__(self, **kwargs):
"""Deep linking navigation button."""Components for handling various media types including images, audio, video with upload, display, and processing capabilities.
class Image:
def __init__(
self,
value=None,
height=None,
width=None,
image_mode="RGB",
sources=None,
type="numpy",
label=None,
every=None,
show_label=None,
show_download_button=True,
container=True,
scale=None,
min_width=160,
interactive=None,
visible=True,
elem_id=None,
elem_classes=None,
render=True,
show_share_button=None,
show_fullscreen_button=True,
**kwargs
):
"""
Image upload and display component.
Parameters:
- value: Default image
- height/width: Component dimensions
- image_mode: Color mode ("RGB", "RGBA", "L")
- sources: Input sources ("upload", "webcam", "clipboard")
- type: Return type ("numpy", "pil", "filepath")
- show_download_button: Whether to show download button
- show_share_button: Whether to show share button
- show_fullscreen_button: Whether to show fullscreen button
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
def select(self, fn, inputs=None, outputs=None, **kwargs): ...
def upload(self, fn, inputs=None, outputs=None, **kwargs): ...
class Audio:
def __init__(
self,
value=None,
sources=None,
type="numpy",
label=None,
every=None,
show_label=None,
container=True,
scale=None,
min_width=160,
interactive=None,
visible=True,
elem_id=None,
elem_classes=None,
render=True,
format="wav",
autoplay=False,
show_download_button=None,
show_share_button=None,
editable=True,
**kwargs
):
"""
Audio upload, recording, and playback component.
Parameters:
- sources: Input sources ("upload", "microphone")
- type: Return type ("numpy", "filepath")
- format: Audio format ("wav", "mp3")
- autoplay: Whether to autoplay audio
- editable: Whether audio is editable
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
def play(self, fn, inputs=None, outputs=None, **kwargs): ...
def pause(self, fn, inputs=None, outputs=None, **kwargs): ...
class Video:
def __init__(
self,
value=None,
format=None,
sources=None,
height=None,
width=None,
label=None,
every=None,
show_label=None,
container=True,
scale=None,
min_width=160,
interactive=None,
visible=True,
elem_id=None,
elem_classes=None,
render=True,
mirror_webcam=True,
include_audio=True,
autoplay=False,
show_share_button=None,
show_download_button=None,
**kwargs
):
"""
Video upload and display component.
Parameters:
- sources: Input sources ("upload", "webcam")
- format: Video format
- mirror_webcam: Whether to mirror webcam
- include_audio: Whether to include audio
- autoplay: Whether to autoplay video
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
def play(self, fn, inputs=None, outputs=None, **kwargs): ...
def pause(self, fn, inputs=None, outputs=None, **kwargs): ...Form control components for user input including sliders, dropdowns, checkboxes, and other interactive form elements.
class Slider:
def __init__(
self,
minimum=0,
maximum=100,
value=None,
step=None,
label=None,
info=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
interactive=None,
visible=True,
**kwargs
):
"""
Numeric slider input component.
Parameters:
- minimum: Minimum value
- maximum: Maximum value
- value: Default value
- step: Step size for increments
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
def input(self, fn, inputs=None, outputs=None, **kwargs): ...
def release(self, fn, inputs=None, outputs=None, **kwargs): ...
class Number:
def __init__(
self,
value=None,
label=None,
info=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
interactive=None,
visible=True,
minimum=None,
maximum=None,
step=1,
**kwargs
):
"""
Numeric input field with validation.
Parameters:
- minimum/maximum: Value bounds
- step: Increment step size
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
def input(self, fn, inputs=None, outputs=None, **kwargs): ...
def focus(self, fn, inputs=None, outputs=None, **kwargs): ...
def blur(self, fn, inputs=None, outputs=None, **kwargs): ...
def submit(self, fn, inputs=None, outputs=None, **kwargs): ...
class Checkbox:
def __init__(
self,
value=False,
label=None,
info=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
interactive=None,
visible=True,
**kwargs
):
"""Boolean checkbox input."""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
class CheckboxGroup:
def __init__(
self,
choices=None,
value=None,
type="value",
label=None,
info=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
interactive=None,
visible=True,
**kwargs
):
"""
Multiple checkbox selection.
Parameters:
- choices: List of options
- value: Default selected values
- type: Return type ("value" or "index")
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
class Radio:
def __init__(
self,
choices=None,
value=None,
type="value",
label=None,
info=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
interactive=None,
visible=True,
**kwargs
):
"""
Single selection radio buttons.
Parameters:
- choices: List of options
- value: Default selected value
- type: Return type ("value" or "index")
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
class Dropdown:
def __init__(
self,
choices=None,
value=None,
type="value",
multiselect=False,
max_choices=None,
label=None,
info=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
interactive=None,
visible=True,
allow_custom_value=False,
**kwargs
):
"""
Dropdown selection menu.
Parameters:
- choices: List of options
- multiselect: Whether to allow multiple selections
- max_choices: Maximum number of selections
- allow_custom_value: Whether to allow custom values
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
def select(self, fn, inputs=None, outputs=None, **kwargs): ...
def input(self, fn, inputs=None, outputs=None, **kwargs): ...
def focus(self, fn, inputs=None, outputs=None, **kwargs): ...
def blur(self, fn, inputs=None, outputs=None, **kwargs): ...
class ColorPicker:
def __init__(
self,
value=None,
label=None,
info=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
interactive=None,
visible=True,
**kwargs
):
"""Color selection input widget."""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
class DateTime:
def __init__(
self,
value=None,
label=None,
info=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
interactive=None,
visible=True,
**kwargs
):
"""Date and time picker component."""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...Components for file handling including upload, download, and file system navigation with support for various file types and operations.
class File:
def __init__(
self,
value=None,
file_count="single",
file_types=None,
type="filepath",
label=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
interactive=None,
visible=True,
height=None,
**kwargs
):
"""
File upload and download component.
Parameters:
- file_count: "single" or "multiple"
- file_types: List of allowed extensions
- type: Return type ("filepath", "binary")
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
def select(self, fn, inputs=None, outputs=None, **kwargs): ...
def upload(self, fn, inputs=None, outputs=None, **kwargs): ...
class FileExplorer:
def __init__(
self,
root_dir=".",
glob="**/*.*",
value=None,
file_count="single",
label=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
interactive=None,
visible=True,
height=None,
**kwargs
):
"""
File system navigation interface.
Parameters:
- root_dir: Root directory to explore
- glob: File pattern to match
- file_count: "single" or "multiple"
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...Components for displaying various types of data including formatted text, structured data, and visualization outputs.
class Label:
def __init__(
self,
value=None,
num_top_classes=None,
label=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
visible=True,
color=None,
**kwargs
):
"""
Display classification results with confidence scores.
Parameters:
- num_top_classes: Number of top classes to show
- color: Color scheme for labels
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
def select(self, fn, inputs=None, outputs=None, **kwargs): ...
class JSON:
def __init__(
self,
value=None,
label=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
visible=True,
**kwargs
):
"""Interactive JSON data display."""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
class Html:
def __init__(
self,
value="",
label=None,
every=None,
show_label=None,
visible=True,
elem_id=None,
elem_classes=None,
render=True,
**kwargs
):
"""Raw HTML content renderer."""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
class Markdown:
def __init__(
self,
value="",
label=None,
every=None,
show_label=None,
visible=True,
elem_id=None,
elem_classes=None,
render=True,
latex_delimiters=None,
sanitize_html=True,
line_breaks=False,
header_links=False,
**kwargs
):
"""
Markdown content renderer with formatting.
Parameters:
- latex_delimiters: LaTeX delimiter configuration
- sanitize_html: Whether to sanitize HTML
- line_breaks: Whether to convert line breaks
- header_links: Whether to add header links
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
class Code:
def __init__(
self,
value="",
language=None,
label=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
visible=True,
interactive=None,
**kwargs
):
"""
Syntax-highlighted code display.
Parameters:
- language: Programming language for syntax highlighting
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
class Dataframe:
def __init__(
self,
value=None,
headers=None,
datatype=None,
row_count=None,
col_count=None,
label=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
interactive=None,
visible=True,
wrap=False,
**kwargs
):
"""
Interactive tabular data display and editing.
Parameters:
- headers: Column headers
- datatype: Data types for columns
- row_count: Number of rows
- col_count: Number of columns
- wrap: Whether to wrap cell content
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
def select(self, fn, inputs=None, outputs=None, **kwargs): ...
class Gallery:
def __init__(
self,
value=None,
format="webp",
label=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
visible=True,
allow_preview=True,
preview=None,
selected_index=None,
columns=2,
rows=None,
height=None,
object_fit="cover",
show_share_button=None,
show_download_button=True,
**kwargs
):
"""
Image gallery with thumbnail navigation.
Parameters:
- format: Image format for thumbnails
- allow_preview: Whether to allow image preview
- columns: Number of columns in grid
- rows: Number of rows in grid
- object_fit: CSS object-fit property
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
def select(self, fn, inputs=None, outputs=None, **kwargs): ...Advanced components for specific use cases including chat interfaces, image editing, 3D models, and custom visualizations.
class Chatbot:
def __init__(
self,
value=None,
label=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
visible=True,
height=None,
latex_delimiters=None,
rtl=False,
show_share_button=None,
show_copy_button=False,
avatar_images=None,
sanitize_html=True,
render_markdown=True,
bubble_full_width=True,
line_breaks=True,
likeable=False,
layout="bubble",
**kwargs
):
"""
Chat conversation display with message history.
Parameters:
- avatar_images: User and bot avatar images
- layout: Chat layout ("bubble" or "panel")
- likeable: Whether to show like/dislike buttons
- bubble_full_width: Whether bubbles fill width
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
def select(self, fn, inputs=None, outputs=None, **kwargs): ...
def like(self, fn, inputs=None, outputs=None, **kwargs): ...
class AnnotatedImage:
def __init__(
self,
value=None,
height=None,
width=None,
label=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
visible=True,
**kwargs
):
"""
Image display with overlay annotations and interactive regions.
Parameters:
- value: Image with annotations data
- height/width: Component dimensions
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
def select(self, fn, inputs=None, outputs=None, **kwargs): ...
class ImageSlider:
def __init__(
self,
value=None,
label=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
visible=True,
position=0.5,
**kwargs
):
"""
Before/after image comparison slider.
Parameters:
- value: Tuple of (before_image, after_image)
- position: Initial slider position (0.0 to 1.0)
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
class ImageEditor:
def __init__(
self,
value=None,
height=None,
width=None,
image_mode="RGB",
sources=None,
type="numpy",
label=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
interactive=None,
visible=True,
brush=None,
eraser=None,
**kwargs
):
"""
Interactive image editing interface.
Parameters:
- brush: Brush tool configuration
- eraser: Eraser tool configuration
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
class Model3D:
def __init__(
self,
value=None,
clear_color=None,
label=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
visible=True,
camera_position=None,
**kwargs
):
"""
3D model viewer and display.
Parameters:
- clear_color: Background color
- camera_position: Initial camera position
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
class Plot:
def __init__(
self,
value=None,
label=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
visible=True,
**kwargs
):
"""Matplotlib/Plotly plot display and interaction."""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
class BarPlot:
def __init__(
self,
value=None,
x=None,
y=None,
color=None,
vertical=True,
group=None,
title=None,
tooltip=None,
x_title=None,
y_title=None,
color_legend_title=None,
group_title=None,
color_legend_position=None,
height=None,
width=None,
x_lim=None,
y_lim=None,
caption=None,
interactive=None,
label=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
visible=True,
**kwargs
):
"""
Native bar chart component for categorical data visualization.
Parameters:
- value: Plot data (pandas DataFrame or compatible format)
- x: Column name for x-axis values
- y: Column name for y-axis values
- color: Column name for color grouping
- vertical: Whether bars are vertical (True) or horizontal (False)
- group: Column name for grouping bars
- title: Plot title
- tooltip: Columns to show in tooltip
- x_title: X-axis label
- y_title: Y-axis label
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
class LinePlot:
def __init__(
self,
value=None,
x=None,
y=None,
color=None,
stroke_dash=None,
overlay_point=False,
title=None,
tooltip=None,
x_title=None,
y_title=None,
color_legend_title=None,
stroke_dash_legend_title=None,
color_legend_position=None,
height=None,
width=None,
x_lim=None,
y_lim=None,
caption=None,
interactive=None,
label=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
visible=True,
**kwargs
):
"""
Native line chart component for continuous data visualization.
Parameters:
- value: Plot data (pandas DataFrame or compatible format)
- x: Column name for x-axis values
- y: Column name for y-axis values
- color: Column name for color grouping of lines
- stroke_dash: Column name for line dash pattern grouping
- overlay_point: Whether to show points on lines
- title: Plot title
- tooltip: Columns to show in tooltip
- x_title: X-axis label
- y_title: Y-axis label
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...
class ScatterPlot:
def __init__(
self,
value=None,
x=None,
y=None,
color=None,
size=None,
shape=None,
title=None,
tooltip=None,
x_title=None,
y_title=None,
color_legend_title=None,
size_legend_title=None,
shape_legend_title=None,
color_legend_position=None,
height=None,
width=None,
x_lim=None,
y_lim=None,
caption=None,
interactive=None,
label=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
visible=True,
**kwargs
):
"""
Native scatter plot component for correlation visualization.
Parameters:
- value: Plot data (pandas DataFrame or compatible format)
- x: Column name for x-axis values
- y: Column name for y-axis values
- color: Column name for color grouping of points
- size: Column name for point size scaling
- shape: Column name for point shape grouping
- title: Plot title
- tooltip: Columns to show in tooltip
- x_title: X-axis label
- y_title: Y-axis label
"""
def change(self, fn, inputs=None, outputs=None, **kwargs): ...Helper components for state management, timing, examples, and specialized functionality.
class State:
def __init__(self, value=None, **kwargs):
"""
Persistent state storage across sessions.
Parameters:
- value: Initial state value
"""
class Timer:
def __init__(self, value=1, **kwargs):
"""
Periodic event trigger for animations.
Parameters:
- value: Timer interval in seconds
"""
def tick(self, fn, inputs=None, outputs=None, **kwargs): ...
class Dataset:
def __init__(
self,
components,
samples,
headers=None,
type="values",
samples_per_page=10,
label=None,
every=None,
show_label=None,
container=True,
scale=None,
elem_id=None,
elem_classes=None,
render=True,
visible=True,
**kwargs
):
"""
Example dataset display and selection.
Parameters:
- components: List of component types
- samples: List of example data
- headers: Column headers
- type: Data type ("values" or "index")
- samples_per_page: Pagination size
"""
def click(self, fn, inputs=None, outputs=None, **kwargs): ...
class BrowserState:
def __init__(self, value=None, **kwargs):
"""
Browser-specific state management for client-side persistence.
Data persists across page reloads within the same browser session.
Parameters:
- value: Initial browser state value
"""Pre-configured component variants with common settings for specific use cases.
# Text input templates
TextArea = Textbox # Multi-line text input (lines=7)
# File handling templates
Files = File # Multiple file upload
Numpy = File # NumPy array file handling
# Media templates
Mic = Audio # Microphone recording
Microphone = Audio # Alternative microphone
PlayableVideo = Video # Video with controls
# Drawing templates
Paint = Image # Drawing canvas
Sketchpad = Image # Sketching interface
ImageMask = Image # Image masking
# Data templates
List = JSON # List data display
Matrix = Dataframe # Matrix data displayclass FileData:
"""File metadata and path information."""
path: str
size: int
orig_name: str
class ImageData:
"""Image data with metadata."""
path: str
url: str
size: tuple
orig_name: str
class MessageDict:
"""Chat message structure."""
role: str # "user" or "assistant"
content: str
metadata: dict
class InputHTMLAttributes:
"""HTML input attributes configuration."""
# Standard HTML input attributes
class WaveformOptions:
"""Waveform display options for Audio component."""
waveform_color: str | None = None
waveform_progress_color: str | None = None
trim_region_color: str | None = None
show_recording_waveform: bool = True
skip_length: int | float = 5
sample_rate: int = 44100
class Brush:
"""Brush tool configuration for ImageEditor."""
default_size: int | str = "auto"
colors: list[str] = None
default_color: str = "black"
class Eraser:
"""Eraser tool configuration for ImageEditor."""
default_size: int | str = "auto"
class LayerOptions:
"""Layer management options for ImageEditor."""
visible: bool = True
position: tuple[int, int] = (0, 0)
class WebcamOptions:
"""Webcam configuration for ImageEditor."""
mirror: bool = True
constraints: dict = NoneInstall with Tessl CLI
npx tessl i tessl/pypi-gradio