Spaces:
Sleeping
Sleeping
Synced repo using 'sync_with_huggingface' Github Action
Browse files
app.py
CHANGED
@@ -12,31 +12,37 @@ palette_columns = ["pal_1", "pal_3", "pal_5"]
|
|
12 |
|
13 |
df = dataset_wrangler.clean_df(dataset=dataset, subset=palette_columns)
|
14 |
|
15 |
-
random_selection = df.sample(n=3)
|
16 |
|
17 |
-
|
18 |
-
lambda x:
|
19 |
)
|
20 |
|
21 |
-
# for img in random_selection["iiif_url"].values.tolist():
|
22 |
-
# st.image(img)
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
28 |
|
29 |
-
|
30 |
-
max_year = df["created_year"].max()
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
min_year,
|
35 |
-
max_year,
|
36 |
-
(min_year, max_year),
|
37 |
)
|
38 |
|
39 |
-
|
|
|
40 |
|
41 |
|
42 |
p = dataset_wrangler.create_grid(df)
|
|
|
12 |
|
13 |
df = dataset_wrangler.clean_df(dataset=dataset, subset=palette_columns)
|
14 |
|
|
|
15 |
|
16 |
+
df["created_year"] = df["Created - W 3 CDTF (DCTERMS)"].apply(
|
17 |
+
lambda x: dataset_wrangler.split_created_year(x)[0]
|
18 |
)
|
19 |
|
|
|
|
|
20 |
|
21 |
+
with st.form("my_form"):
|
22 |
+
st.write
|
23 |
+
min_year = df["created_year"].min()
|
24 |
+
max_year = df["created_year"].max()
|
25 |
+
values = st.slider(
|
26 |
+
"Select a year range: ",
|
27 |
+
min_year,
|
28 |
+
max_year,
|
29 |
+
(min_year, max_year),
|
30 |
+
)
|
31 |
+
st.form_submit_button("Visualise my selection")
|
32 |
|
33 |
+
st.write(f"Min: {min_year} Max: {max_year}")
|
34 |
+
st.write(f"Min val: {values[0]} Max val: {values[1]}")
|
35 |
+
|
36 |
+
df = df[df["created_year"].between(values[0], values[1])]
|
37 |
|
38 |
+
random_selection = df.sample(n=3)
|
|
|
39 |
|
40 |
+
random_selection["iiif_url"] = random_selection["IE PID"].apply(
|
41 |
+
lambda x: image_analysis.get_iiif_image_urls(x)
|
|
|
|
|
|
|
42 |
)
|
43 |
|
44 |
+
for img in random_selection["iiif_url"].values.tolist():
|
45 |
+
st.image(img)
|
46 |
|
47 |
|
48 |
p = dataset_wrangler.create_grid(df)
|