prakharg24 commited on
Commit
18c2aeb
·
verified ·
1 Parent(s): 291e60a

Update my_pages/ica.py

Browse files
Files changed (1) hide show
  1. my_pages/ica.py +12 -11
my_pages/ica.py CHANGED
@@ -1,7 +1,7 @@
1
  import streamlit as st
2
  import matplotlib.pyplot as plt
3
  import numpy as np
4
- from utils import add_navigation, add_instruction_text
5
 
6
  plt.style.use('dark_background')
7
 
@@ -10,7 +10,8 @@ def render():
10
 
11
  add_instruction_text(
12
  """
13
- Explore the intention-convention-arbitrariness (ICA) framework by uncovering various examples.
 
14
  """
15
  )
16
 
@@ -25,7 +26,8 @@ def render():
25
  control_choice = st.radio(
26
  "Select dimension to adjust",
27
  ["Intentional", "Conventional", "Arbitrary"],
28
- horizontal=True
 
29
  )
30
 
31
  # Current values
@@ -33,7 +35,7 @@ def render():
33
  current_value = w[control_choice]
34
 
35
  # Slider for selected one
36
- new_value = st.slider(control_choice, 0.0, 1.0, current_value, 0.01)
37
 
38
  # Adjust others proportionally
39
  diff = new_value - current_value
@@ -98,7 +100,11 @@ def render():
98
 
99
  torch_radius = 0.177 # how far the "torch" illuminates
100
 
101
- text_to_show = "Explanations<br>"
 
 
 
 
102
  # Illuminate nearby points
103
  for (x, y, label, labeltext, ha, va) in locations:
104
  dist = np.linalg.norm([x - point[0], y - point[1]])
@@ -108,11 +114,6 @@ def render():
108
  text_to_show += label + ": " + labeltext + "<br>"
109
  else:
110
  ax.scatter(x, y, c="red", s=50, zorder=6, alpha=0.3)
111
-
112
- st.pyplot(fig)
113
 
114
  if len(text_to_show) > 0:
115
- st.markdown(
116
- f"<div style='text-align:center; color:#c0392b; font-size:20px; font-weight:bold; margin:14px 0;'>{text_to_show}</div>",
117
- unsafe_allow_html=True,
118
- )
 
1
  import streamlit as st
2
  import matplotlib.pyplot as plt
3
  import numpy as np
4
+ from utils import add_navigation, add_instruction_text, add_red_text
5
 
6
  plt.style.use('dark_background')
7
 
 
10
 
11
  add_instruction_text(
12
  """
13
+ Explore the intention-convention-arbitrariness (ICA) framework.<br>
14
+ Use different sliders to uncover examples in the ICA triangle.
15
  """
16
  )
17
 
 
26
  control_choice = st.radio(
27
  "Select dimension to adjust",
28
  ["Intentional", "Conventional", "Arbitrary"],
29
+ horizontal=True,
30
+ label_visibility="collapsed"
31
  )
32
 
33
  # Current values
 
35
  current_value = w[control_choice]
36
 
37
  # Slider for selected one
38
+ new_value = st.slider(control_choice, 0.0, 1.0, current_value, 0.01, label_visibility="collapsed")
39
 
40
  # Adjust others proportionally
41
  diff = new_value - current_value
 
100
 
101
  torch_radius = 0.177 # how far the "torch" illuminates
102
 
103
+ col1, col2, col3 = st.columns([0.5, 1, 0.5])
104
+ with col2:
105
+ st.pyplot(fig)
106
+
107
+ text_to_show = ""
108
  # Illuminate nearby points
109
  for (x, y, label, labeltext, ha, va) in locations:
110
  dist = np.linalg.norm([x - point[0], y - point[1]])
 
114
  text_to_show += label + ": " + labeltext + "<br>"
115
  else:
116
  ax.scatter(x, y, c="red", s=50, zorder=6, alpha=0.3)
 
 
117
 
118
  if len(text_to_show) > 0:
119
+ add_red_text(text_to_show)