sotirios-slv commited on
Commit
c39f4d0
·
verified ·
1 Parent(s): fc80367

Synced repo using 'sync_with_huggingface' Github Action

Browse files
Files changed (2) hide show
  1. app.py +5 -17
  2. dataset_wrangler.py +1 -3
app.py CHANGED
@@ -1,6 +1,3 @@
1
- from bokeh import events
2
- from bokeh.models import CustomJS
3
-
4
  import streamlit as st
5
 
6
  import dataset_wrangler
@@ -11,23 +8,14 @@ st.write(
11
  "Scrambled Images from [https://www.slv.vic.gov.au/images](https://www.slv.vic.gov.au/images)"
12
  )
13
 
 
14
 
15
- p = dataset_wrangler.create_grid(dataset)
16
 
17
- callback = CustomJS(
18
- code="""
19
- console.log(Math.floor(cb_obj.x))
20
- console.log(Math.floor(cb_obj.y))
21
 
22
- try {
23
- console.log("Hello mum")
24
- st.write("Hello mum")
25
- } catch {
26
- console.log("error")
27
- }
28
- """
29
- )
30
 
31
- p.js_on_event(events.Tap, callback)
32
 
33
  st.bokeh_chart(p, use_container_width=True)
 
 
 
 
1
  import streamlit as st
2
 
3
  import dataset_wrangler
 
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
 
13
+ df = dataset_wrangler.clean_df(dataset=dataset, subset=palette_columns)
14
 
15
+ random_selection = df.sample(n=3)
 
 
 
16
 
17
+ st.dataframe(random_selection)
 
 
 
 
 
 
 
18
 
19
+ p = dataset_wrangler.create_grid(df)
20
 
21
  st.bokeh_chart(p, use_container_width=True)
dataset_wrangler.py CHANGED
@@ -68,7 +68,7 @@ def get_tooltips_dict(df, columns):
68
  return tooltips
69
 
70
 
71
- def create_grid(dataset, palette_columns=["pal_1", "pal_3", "pal_5"]):
72
 
73
  markers = {
74
  "pal_1": "circle",
@@ -78,8 +78,6 @@ def create_grid(dataset, palette_columns=["pal_1", "pal_3", "pal_5"]):
78
  "pal_5": "triangle",
79
  }
80
 
81
- df = clean_df(dataset=dataset, subset=palette_columns)
82
-
83
  coords = get_square_coords(df)
84
 
85
  # bodge the df to ensure the length matches the coords
 
68
  return tooltips
69
 
70
 
71
+ def create_grid(df, palette_columns=["pal_1", "pal_3", "pal_5"]):
72
 
73
  markers = {
74
  "pal_1": "circle",
 
78
  "pal_5": "triangle",
79
  }
80
 
 
 
81
  coords = get_square_coords(df)
82
 
83
  # bodge the df to ensure the length matches the coords