Skip to content
PYGWALKER
API Reference
Gradio Walker APIs

Gradio API

Users can render the UI of Graphic Walker onto gradio application.

get_html_on_gradio

import gradio as gr
import pandas as pd
 
from pygwalker.api.gradio import PYGWALKER_ROUTE, get_html_on_gradio
 
with gr.Blocks() as demo:
    df = pd.read_csv("data.csv")
    pyg_html = get_html_on_gradio(df, spec="./gw_config.json", spec_io_mode="rw")
    gr.HTML(pyg_html)
 
 
app = demo.launch(app_kwargs={
    "routes": [PYGWALKER_ROUTE]
})
 

Parameters

ParameterTypeDefaultDescription
datasetUnion[DataFrame, Connector]-The dataframe or connector to be used. refer Dataset Of Walker.
gidUnion[int, str]NoneID for the GraphicWalker container div, formatted as 'gwalker-{gid}'. If gid is None, it will be automatically generated.
field_specsOptional[Dict[str, FieldSpec]]NoneSpecifications of fields. Will be automatically inferred from dataset if not specified.
theme_keyLiteral['vega', 'g2']'g2'Theme type for the GraphicWalker.
appearanceLiteral['media', 'light', 'dark']'media'Theme setting. 'media' will auto-detect the OS theme.
specstr""Chart configuration data. Can be a configuration ID, JSON, or remote file URL.
spec_io_modeLiteral["r", "rw"]"r"spec io mode, Default to "r", "r" for read, "rw" for read and write.
use_kernel_calcboolNoneIf True, uses kernel computation for data, it can support high performance in larger dataset. Default to None, automatically determine whether to use kernel calculation.
kanaries_api_keystr""kanaries api key, Default to "".
default_tabLiteral["data", "vis"]"vis"default tab to show. Default to "vis".
**kwargsAny-Additional keyword arguments.