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

Update my_pages/ica.py

Browse files
Files changed (1) hide show
  1. my_pages/ica.py +10 -7
my_pages/ica.py CHANGED
@@ -99,21 +99,24 @@ def render():
99
  ]
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]])
111
  if dist <= torch_radius:
112
  ax.scatter(x, y, c="red", s=50, zorder=6)
113
  ax.text(x, y + 0.03, label, ha=ha, va=va, color="red", zorder=6)
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)
 
99
  ]
100
 
101
  torch_radius = 0.177 # how far the "torch" illuminates
 
 
 
 
102
 
103
+ explanations = []
104
  # Illuminate nearby points
105
  for (x, y, label, labeltext, ha, va) in locations:
106
  dist = np.linalg.norm([x - point[0], y - point[1]])
107
  if dist <= torch_radius:
108
  ax.scatter(x, y, c="red", s=50, zorder=6)
109
  ax.text(x, y + 0.03, label, ha=ha, va=va, color="red", zorder=6)
110
+ explanations.append((label, labeltext))
111
  else:
112
  ax.scatter(x, y, c="red", s=50, zorder=6, alpha=0.3)
113
 
114
+ col1, col2, col3 = st.columns([0.3, 1, 0.3])
115
+ with col2:
116
+ st.pyplot(fig)
117
+
118
+ if len(explanations) > 0:
119
+ text_to_show = ""
120
+ for label, labeltext in explanations:
121
+ text_to_show += "**" + label + ":** " + labeltext + "<br>"
122
  add_red_text(text_to_show)