sotirios-slv commited on
Commit
fabc384
·
verified ·
1 Parent(s): 1437ac6

Synced repo using 'sync_with_huggingface' Github Action

Browse files
__pycache__/dataset_wrangler.cpython-311.pyc ADDED
Binary file (5.99 kB). View file
 
app.py CHANGED
@@ -4,9 +4,9 @@ import dataset_wrangler, image_analysis
4
 
5
  dataset = "https://raw.githubusercontent.com/StateLibraryVictoria/public-domain-hack-2024/refs/heads/ch4-data-viz/datasets/ch3_colour_data_viz_suggestions_set_2_augmented.csv"
6
 
7
- st.write(
8
- "Scrambled Images from [https://www.slv.vic.gov.au/images](https://www.slv.vic.gov.au/images)"
9
- )
10
 
11
  palette_columns = ["pal_1", "pal_3", "pal_5"]
12
 
@@ -18,14 +18,17 @@ random_selection["iiif_url"] = random_selection["IE PID"].apply(
18
  lambda x: image_analysis.get_iiif_image_urls(x)
19
  )
20
 
21
- for img in random_selection["iiif_url"].values.tolist():
22
- st.image(img)
23
 
24
 
25
  df["created_year"] = df["Created - W 3 CDTF (DCTERMS)"].apply(
26
  lambda x: dataset_wrangler.split_created_year(x)[0]
27
  )
28
 
 
 
 
29
  values = st.slider(
30
  "Select a year range: ",
31
  df["created_year"].min(),
@@ -33,7 +36,6 @@ values = st.slider(
33
  (df["created_year"].min(), df["created_year"].max()),
34
  )
35
 
36
- # print(df["created_year"])
37
 
38
  p = dataset_wrangler.create_grid(df)
39
 
 
4
 
5
  dataset = "https://raw.githubusercontent.com/StateLibraryVictoria/public-domain-hack-2024/refs/heads/ch4-data-viz/datasets/ch3_colour_data_viz_suggestions_set_2_augmented.csv"
6
 
7
+ # st.write(
8
+ # "Scrambled Images from [https://www.slv.vic.gov.au/images](https://www.slv.vic.gov.au/images)"
9
+ # )
10
 
11
  palette_columns = ["pal_1", "pal_3", "pal_5"]
12
 
 
18
  lambda x: image_analysis.get_iiif_image_urls(x)
19
  )
20
 
21
+ # for img in random_selection["iiif_url"].values.tolist():
22
+ # st.image(img)
23
 
24
 
25
  df["created_year"] = df["Created - W 3 CDTF (DCTERMS)"].apply(
26
  lambda x: dataset_wrangler.split_created_year(x)[0]
27
  )
28
 
29
+ min_year = df["created_year"].min()
30
+ max_year = df["created_year"].max()
31
+
32
  values = st.slider(
33
  "Select a year range: ",
34
  df["created_year"].min(),
 
36
  (df["created_year"].min(), df["created_year"].max()),
37
  )
38
 
 
39
 
40
  p = dataset_wrangler.create_grid(df)
41
 
dataset_wrangler.py CHANGED
@@ -1,5 +1,6 @@
1
  import pandas as pd
2
  import math
 
3
 
4
  from bokeh.models import HoverTool
5
  from bokeh.plotting import figure
@@ -8,11 +9,12 @@ from bokeh.models import CustomJS
8
 
9
  def split_created_year(created_year):
10
 
11
- split = created_year.split("/")
12
- start_date = split[0]
13
 
14
- if len(split) > 1:
15
- end_date = split[-1]
 
 
16
  else:
17
  end_date = start_date
18
 
 
1
  import pandas as pd
2
  import math
3
+ import re
4
 
5
  from bokeh.models import HoverTool
6
  from bokeh.plotting import figure
 
9
 
10
  def split_created_year(created_year):
11
 
12
+ matches = re.findall("([1-3][0-9]{3})", created_year)
 
13
 
14
+ start_date = int(matches[0])
15
+
16
+ if len(matches) > 1:
17
+ end_date = int(matches[-1])
18
  else:
19
  end_date = start_date
20