Skip to content

Commit eb0afb0

Browse files
authored
build miniapp
1 parent 5399faf commit eb0afb0

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

.github/workflows/dash.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: dash
2+
on: push
3+
jobs:
4+
mini-app:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@main
8+
- run: |
9+
pip install dash
10+
pip install pandas
11+
- run: python Dash/app.py
12+
timeout-minutes: 1
13+
14+

Dash/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Dash.plotly
2+
- Python low-code framework
3+
- For building ML & data science web apps.
4+
- Built on top of Plotly.js, React and Flask

Dash/app.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from dash import Dash, html, dcc, callback, Output, Input
2+
import plotly.express as px
3+
import pandas as pd
4+
5+
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder_unfiltered.csv')
6+
7+
app = Dash()
8+
9+
app.layout = [
10+
html.H1(children='Title of Dash App', style={'textAlign':'center'}),
11+
dcc.Dropdown(df.country.unique(), 'Canada', id='dropdown-selection'),
12+
dcc.Graph(id='graph-content')
13+
]
14+
15+
@callback(
16+
Output('graph-content', 'figure'),
17+
Input('dropdown-selection', 'value')
18+
)
19+
def update_graph(value):
20+
dff = df[df.country==value]
21+
return px.line(dff, x='year', y='pop')
22+
23+
if __name__ == '__main__':
24+
app.run(debug=True)

0 commit comments

Comments
 (0)