import gradio as gr import plotly.express as px import pandas as pd # sample data df = px.data.gapminder() def make_plot(country): data = df[df.country == country] fig = px.line(data, x="year", y="gdpPercap", title=f"GDP per Capita: {country}") return fig countries = sorted(df.country.unique()) demo = gr.Interface( fn=make_plot, inputs=gr.Dropdown(countries, label="Select a country"), outputs=gr.Plot(label="GDP per Capita Plot"), title="Gapminder GDP Dashboard" ) # Note that share=True makes a publicly available URL available. # The URL is publicly available as long as your local gradio session is running. if __name__ == "__main__": demo.launch(share=True)