Skip to content

Use pygwalker in graido

Elwynn Chen edited this page Feb 4, 2024 · 2 revisions

Install dependencies

pip install pygwalker
pip install gradio
pip install pandas

Coding

  • gradio_demo.py
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("xxx.csv")
    pyg_html = get_html_on_gradio(df, spec="gw_config.json", debug=True)
    gr.HTML(pyg_html)


app = demo.launch(app_kwargs={
    "routes": [PYGWALKER_ROUTE]
})

Run

gradio gradio_demo.py