FagerholmEmil commited on
Commit
b2cc040
·
1 Parent(s): 37e567c

Add activation threshold parameter to random neuron discovery

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -80,7 +80,7 @@ Nested loops:
80
 
81
  The moon glows silver, wanes to shadow.
82
  Patterns persist: 11, 22, 33—harmonic echoes.
83
- Reshape,” calls the river, reflect, refract, renew.”
84
  Yellow hexagons tessellate, shifting into orange octagons.
85
  1/3 -> 1/9 -> 1/27: recursive reduction spirals infinitely.
86
 
@@ -117,7 +117,7 @@ Symmetry hums:
117
  Palindromes—"radar", "level", "madam"—appear and fade.
118
  Blue fades to white, white dissolves to black.
119
  Sequences echo: 1, 10, 100, 1000…
120
- Cycle,” whispers the clock, count forward, reverse.""" # Shortened for example
121
  default_layer = 1
122
  default_neuron_index = 1
123
  default_max_val = 4.0
@@ -147,6 +147,7 @@ with gr.Blocks() as demo:
147
  neuron_index = gr.Number(
148
  label="Neuron Index", value=default_neuron_index, precision=0
149
  )
 
150
  random_btn = gr.Button("Find Random Active Neuron")
151
  max_val = gr.Number(label="Max Value", value=default_max_val)
152
  min_val = gr.Number(label="Min Value", value=default_min_val)
@@ -163,13 +164,13 @@ with gr.Blocks() as demo:
163
  ),
164
  )
165
 
166
- def random_neuron_callback(text):
167
- layer_num, neuron_num = get_random_active_neuron(text)
168
  return layer_num, neuron_num
169
 
170
  random_btn.click(
171
  random_neuron_callback,
172
- inputs=[text],
173
  outputs=[layer, neuron_index]
174
  )
175
 
 
80
 
81
  The moon glows silver, wanes to shadow.
82
  Patterns persist: 11, 22, 33—harmonic echoes.
83
+ "Reshape," calls the river, "reflect, refract, renew."
84
  Yellow hexagons tessellate, shifting into orange octagons.
85
  1/3 -> 1/9 -> 1/27: recursive reduction spirals infinitely.
86
 
 
117
  Palindromes—"radar", "level", "madam"—appear and fade.
118
  Blue fades to white, white dissolves to black.
119
  Sequences echo: 1, 10, 100, 1000…
120
+ "Cycle," whispers the clock, "count forward, reverse.""" # Shortened for example
121
  default_layer = 1
122
  default_neuron_index = 1
123
  default_max_val = 4.0
 
147
  neuron_index = gr.Number(
148
  label="Neuron Index", value=default_neuron_index, precision=0
149
  )
150
+ max_act = gr.Number(label="Min Activation Threshold", value=2.0, precision=2)
151
  random_btn = gr.Button("Find Random Active Neuron")
152
  max_val = gr.Number(label="Max Value", value=default_max_val)
153
  min_val = gr.Number(label="Min Value", value=default_min_val)
 
164
  ),
165
  )
166
 
167
+ def random_neuron_callback(text, threshold):
168
+ layer_num, neuron_num = get_random_active_neuron(text, threshold)
169
  return layer_num, neuron_num
170
 
171
  random_btn.click(
172
  random_neuron_callback,
173
+ inputs=[text, max_act],
174
  outputs=[layer, neuron_index]
175
  )
176