Skip to content

Commit

Permalink
build miniapp
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkhala authored Jun 20, 2024
1 parent 5399faf commit eb0afb0
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/dash.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: dash
on: push
jobs:
mini-app:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- run: |
pip install dash
pip install pandas
- run: python Dash/app.py
timeout-minutes: 1


4 changes: 4 additions & 0 deletions Dash/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Dash.plotly
- Python low-code framework
- For building ML & data science web apps.
- Built on top of Plotly.js, React and Flask
24 changes: 24 additions & 0 deletions Dash/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from dash import Dash, html, dcc, callback, Output, Input
import plotly.express as px
import pandas as pd

df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder_unfiltered.csv')

app = Dash()

app.layout = [
html.H1(children='Title of Dash App', style={'textAlign':'center'}),
dcc.Dropdown(df.country.unique(), 'Canada', id='dropdown-selection'),
dcc.Graph(id='graph-content')
]

@callback(
Output('graph-content', 'figure'),
Input('dropdown-selection', 'value')
)
def update_graph(value):
dff = df[df.country==value]
return px.line(dff, x='year', y='pop')

if __name__ == '__main__':
app.run(debug=True)

0 comments on commit eb0afb0

Please sign in to comment.