Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from dash import Dash, Input, Output, callback, dcc, html
|
| 2 |
+
|
| 3 |
+
app = Dash(__name__)
|
| 4 |
+
md = """
|
| 5 |
+
# Dash demo
|
| 6 |
+
|
| 7 |
+
See [The dash examples index](https://dash-example-index.herokuapp.com/) for more examples.
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
app.layout = html.Div(
|
| 11 |
+
children=[
|
| 12 |
+
dcc.Markdown(children=md, link_target="_blank"),
|
| 13 |
+
dcc.Dropdown(id="dropdown", options=["red", "green", "blue", "orange"]),
|
| 14 |
+
dcc.Markdown(id="markdown", children=["## Hello World"]),
|
| 15 |
+
]
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
@callback(
|
| 20 |
+
Output("markdown", "style"),
|
| 21 |
+
Input("dropdown", "value"),
|
| 22 |
+
)
|
| 23 |
+
def update_markdown_style(color):
|
| 24 |
+
return {"color": color}
|
| 25 |
+
|
| 26 |
+
if __name__ == '__main__':
|
| 27 |
+
app.run_server(host='0.0.0.0', port=8050, debug=False)
|
| 28 |
+
|