Spaces:
Sleeping
Sleeping
File size: 727 Bytes
cb34d4d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
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)
|