#!/usr/bin/env python | |
import gradio as gr | |
import numpy as np | |
import pandas as pd | |
import plotly.express as px | |
np.random.seed(0) | |
df = pd.DataFrame({"x": np.arange(100), "y": np.random.normal(size=100).cumsum()}) | |
fig = px.line(df, x="x", y="y") | |
with gr.Blocks() as demo: | |
with gr.Tabs(): | |
with gr.Tab(label="a"): | |
gr.Plot(value=fig) | |
with gr.Tab(label="b"): | |
gr.Plot(value=fig) | |
if __name__ == "__main__": | |
demo.queue().launch() | |