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
| Parameter | Type | Default | Description | 
|---|---|---|---|
| dataset | Union[DataFrame, Connector] | - | The dataframe or connector to be used. refer Dataset Of Walker. | 
| gid | Union[int, str] | None | ID for the GraphicWalker container div, formatted as 'gwalker-{gid}'. If gid is None, it will be automatically generated. | 
| field_specs | Optional[Dict[str, FieldSpec]] | None | Specifications of fields. Will be automatically inferred from datasetif not specified. | 
| theme_key | Literal['vega', 'g2'] | 'g2' | Theme type for the GraphicWalker. | 
| dark | Literal['media', 'light', 'dark'] | 'media' | Theme setting. 'media' will auto-detect the OS theme. | 
| spec | str | "" | Chart configuration data. Can be a configuration ID, JSON, or remote file URL. | 
| spec_io_mode | Literal["r", "rw"] | "r" | spec io mode, Default to "r", "r" for read, "rw" for read and write. | 
| use_kernel_calc | bool | None | If 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_key | str | "" | kanaries api key, Default to "". | 
| default_tab | Literal["data", "vis"] | "vis" | default tab to show. Default to "vis". | 
| **kwargs | Any | - | Additional keyword arguments. |