Spaces:
Runtime error
Runtime error
Commit
·
272e180
1
Parent(s):
1e0e3a6
shiny v0.6.0; shinyswatch v0.4.1 (#3)
Browse files- shiny v0.6.0; shinyswatch v0.4.1 (8b4dab4d5cce6d3276a4a05d4e7eaf5fd4a4395a)
- Remove shiny.experimental using shiny v0.6.0 (e85cac34cc737f262b265c17f4f8976198517b83)
Co-authored-by: Barret Schloerke <[email protected]>
- app.py +11 -15
- requirements.txt +2 -2
app.py
CHANGED
|
@@ -6,7 +6,6 @@ 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
|
| 11 |
|
| 12 |
sns.set_theme()
|
|
@@ -18,10 +17,10 @@ numeric_cols: List[str] = df.select_dtypes(include=["float64"]).columns.tolist()
|
|
| 18 |
species: List[str] = df["Species"].unique().tolist()
|
| 19 |
species.sort()
|
| 20 |
|
| 21 |
-
app_ui =
|
| 22 |
shinyswatch.theme.minty(),
|
| 23 |
ui.layout_sidebar(
|
| 24 |
-
ui.
|
| 25 |
# Artwork by @allison_horst
|
| 26 |
ui.input_selectize(
|
| 27 |
"xvar",
|
|
@@ -41,16 +40,13 @@ app_ui = x.ui.page_fillable(
|
|
| 41 |
ui.hr(),
|
| 42 |
ui.input_switch("by_species", "Show species", value=True),
|
| 43 |
ui.input_switch("show_margins", "Show marginal plots", value=True),
|
| 44 |
-
width=2,
|
| 45 |
),
|
| 46 |
-
ui.
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
class_="text-end",
|
| 53 |
-
),
|
| 54 |
),
|
| 55 |
),
|
| 56 |
)
|
|
@@ -91,11 +87,11 @@ def server(input: Inputs, output: Outputs, session: Session):
|
|
| 91 |
df = filtered_df()
|
| 92 |
|
| 93 |
def penguin_value_box(title: str, count: int, bgcol: str, showcase_img: str):
|
| 94 |
-
return
|
| 95 |
title,
|
| 96 |
count,
|
| 97 |
{"class_": "pt-1 pb-0"},
|
| 98 |
-
showcase=
|
| 99 |
ui.tags.img(
|
| 100 |
{"style": "object-fit:contain;"},
|
| 101 |
src=showcase_img,
|
|
@@ -127,7 +123,7 @@ def server(input: Inputs, output: Outputs, session: Session):
|
|
| 127 |
if name in input.species()
|
| 128 |
]
|
| 129 |
|
| 130 |
-
return
|
| 131 |
|
| 132 |
|
| 133 |
# "darkorange", "purple", "cyan4"
|
|
|
|
| 6 |
import seaborn as sns
|
| 7 |
import shinyswatch
|
| 8 |
|
|
|
|
| 9 |
from shiny import App, Inputs, Outputs, Session, reactive, render, req, ui
|
| 10 |
|
| 11 |
sns.set_theme()
|
|
|
|
| 17 |
species: List[str] = df["Species"].unique().tolist()
|
| 18 |
species.sort()
|
| 19 |
|
| 20 |
+
app_ui = ui.page_fillable(
|
| 21 |
shinyswatch.theme.minty(),
|
| 22 |
ui.layout_sidebar(
|
| 23 |
+
ui.sidebar(
|
| 24 |
# Artwork by @allison_horst
|
| 25 |
ui.input_selectize(
|
| 26 |
"xvar",
|
|
|
|
| 40 |
ui.hr(),
|
| 41 |
ui.input_switch("by_species", "Show species", value=True),
|
| 42 |
ui.input_switch("show_margins", "Show marginal plots", value=True),
|
|
|
|
| 43 |
),
|
| 44 |
+
ui.output_ui("value_boxes"),
|
| 45 |
+
ui.output_plot("scatter", fill=True),
|
| 46 |
+
ui.help_text(
|
| 47 |
+
"Artwork by ",
|
| 48 |
+
ui.a("@allison_horst", href="https://twitter.com/allison_horst"),
|
| 49 |
+
class_="text-end",
|
|
|
|
|
|
|
| 50 |
),
|
| 51 |
),
|
| 52 |
)
|
|
|
|
| 87 |
df = filtered_df()
|
| 88 |
|
| 89 |
def penguin_value_box(title: str, count: int, bgcol: str, showcase_img: str):
|
| 90 |
+
return ui.value_box(
|
| 91 |
title,
|
| 92 |
count,
|
| 93 |
{"class_": "pt-1 pb-0"},
|
| 94 |
+
showcase=ui.fill.as_fill_item(
|
| 95 |
ui.tags.img(
|
| 96 |
{"style": "object-fit:contain;"},
|
| 97 |
src=showcase_img,
|
|
|
|
| 123 |
if name in input.species()
|
| 124 |
]
|
| 125 |
|
| 126 |
+
return ui.layout_column_wrap(*value_boxes, width = 1 / len(value_boxes))
|
| 127 |
|
| 128 |
|
| 129 |
# "darkorange", "purple", "cyan4"
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
shiny==0.
|
| 2 |
-
shinyswatch==0.
|
| 3 |
seaborn==0.12.2
|
| 4 |
matplotlib==3.7.1
|
|
|
|
| 1 |
+
shiny==0.6.0
|
| 2 |
+
shinyswatch==0.4.1
|
| 3 |
seaborn==0.12.2
|
| 4 |
matplotlib==3.7.1
|