Spaces:
Runtime error
Runtime error
gordon-posit
commited on
Commit
•
cdecab5
1
Parent(s):
161337e
Remove excess files
Browse files- README.md +9 -1
- app.py +20 -2
- colors.py +0 -21
- www/palmerpenguins.png +0 -0
README.md
CHANGED
@@ -8,4 +8,12 @@ pinned: false
|
|
8 |
license: mit
|
9 |
---
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
license: mit
|
9 |
---
|
10 |
|
11 |
+
This is a templated Space for [Shiny for Python](https://shiny.rstudio.com/py/).
|
12 |
+
|
13 |
+
To get started with a new app do the following:
|
14 |
+
|
15 |
+
1) Install Shiny with `pip install shiny`
|
16 |
+
2) Create a new app with `shiny create .`
|
17 |
+
3) Then run the app with `shiny run --reload`
|
18 |
+
|
19 |
+
To learn more about this framework please see the [Documentation](https://shiny.rstudio.com/py/docs/overview.html).
|
app.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
from pathlib import Path
|
2 |
-
from typing import List
|
|
|
3 |
|
4 |
import pandas as pd
|
5 |
import seaborn as sns
|
6 |
import shinyswatch
|
7 |
-
from colors import bg_palette, palette
|
8 |
|
9 |
import shiny.experimental as x
|
10 |
from shiny import App, Inputs, Outputs, Session, reactive, render, req, ui
|
@@ -132,6 +132,24 @@ def server(input: Inputs, output: Outputs, session: Session):
|
|
132 |
return x.ui.layout_column_wrap(1 / len(value_boxes), *value_boxes)
|
133 |
|
134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
app = App(
|
136 |
app_ui,
|
137 |
server,
|
|
|
1 |
from pathlib import Path
|
2 |
+
from typing import List, Dict, Tuple
|
3 |
+
import matplotlib.colors as mpl_colors
|
4 |
|
5 |
import pandas as pd
|
6 |
import seaborn as sns
|
7 |
import shinyswatch
|
|
|
8 |
|
9 |
import shiny.experimental as x
|
10 |
from shiny import App, Inputs, Outputs, Session, reactive, render, req, ui
|
|
|
132 |
return x.ui.layout_column_wrap(1 / len(value_boxes), *value_boxes)
|
133 |
|
134 |
|
135 |
+
# "darkorange", "purple", "cyan4"
|
136 |
+
colors = [[255, 140, 0], [160, 32, 240], [0, 139, 139]]
|
137 |
+
colors = [(r / 255.0, g / 255.0, b / 255.0) for r, g, b in colors]
|
138 |
+
|
139 |
+
palette: Dict[str, Tuple[float, float, float]] = {
|
140 |
+
"Adelie": colors[0],
|
141 |
+
"Chinstrap": colors[1],
|
142 |
+
"Gentoo": colors[2],
|
143 |
+
"default": sns.color_palette()[0], # type: ignore
|
144 |
+
}
|
145 |
+
|
146 |
+
bg_palette = {}
|
147 |
+
# Use `sns.set_style("whitegrid")` to help find approx alpha value
|
148 |
+
for name, col in palette.items():
|
149 |
+
# Adjusted n_colors until `axe` accessibility did not complain about color contrast
|
150 |
+
bg_palette[name] = mpl_colors.to_hex(sns.light_palette(col, n_colors=7)[1]) # type: ignore
|
151 |
+
|
152 |
+
|
153 |
app = App(
|
154 |
app_ui,
|
155 |
server,
|
colors.py
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
from typing import Dict, Tuple
|
2 |
-
|
3 |
-
import matplotlib.colors as mpl_colors
|
4 |
-
import seaborn as sns # type: ignore
|
5 |
-
|
6 |
-
# "darkorange", "purple", "cyan4"
|
7 |
-
colors = [[255, 140, 0], [160, 32, 240], [0, 139, 139]]
|
8 |
-
colors = [(r / 255.0, g / 255.0, b / 255.0) for r, g, b in colors]
|
9 |
-
|
10 |
-
palette: Dict[str, Tuple[float, float, float]] = {
|
11 |
-
"Adelie": colors[0],
|
12 |
-
"Chinstrap": colors[1],
|
13 |
-
"Gentoo": colors[2],
|
14 |
-
"default": sns.color_palette()[0], # type: ignore
|
15 |
-
}
|
16 |
-
|
17 |
-
bg_palette = {}
|
18 |
-
# Use `sns.set_style("whitegrid")` to help find approx alpha value
|
19 |
-
for name, col in palette.items():
|
20 |
-
# Adjusted n_colors until `axe` accessibility did not complain about color contrast
|
21 |
-
bg_palette[name] = mpl_colors.to_hex(sns.light_palette(col, n_colors=7)[1]) # type: ignore
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
www/palmerpenguins.png
DELETED
Binary file (74.9 kB)
|
|