Spaces:
Sleeping
Sleeping
Nu Appleblossom
commited on
Commit
·
1093262
1
Parent(s):
43844be
back to basics
Browse files
app.py
CHANGED
@@ -382,7 +382,7 @@ def process_input(selected_sae, feature_number, weight_type, use_token_centroid,
|
|
382 |
|
383 |
if top_500:
|
384 |
# Generate the top 500 list
|
385 |
-
result = ", ".join([f"{token
|
386 |
logger.info("Returning top 500 list")
|
387 |
return result, None
|
388 |
else:
|
@@ -487,14 +487,14 @@ def gradio_interface():
|
|
487 |
inputs=inputs,
|
488 |
outputs=[output_text, output_image],
|
489 |
show_progress="full"
|
490 |
-
)
|
491 |
|
492 |
generate_top_500_btn.click(
|
493 |
generate_top_500,
|
494 |
inputs=inputs,
|
495 |
outputs=[output_500_text],
|
496 |
show_progress="full"
|
497 |
-
)
|
498 |
|
499 |
trim_btn.click(trim_tree, inputs=[trim_slider, tree_data_state], outputs=[output_image])
|
500 |
|
@@ -504,7 +504,7 @@ def gradio_interface():
|
|
504 |
feature_number.change(update_neuronpedia, inputs=[selected_sae, feature_number], outputs=[neuronpedia_html])
|
505 |
|
506 |
output_text.change(
|
507 |
-
lambda text: (gr.update(visible=True), gr.update(visible=True)) if "100 tokens" in text else (gr.update(visible
|
508 |
inputs=[output_text],
|
509 |
outputs=[generate_top_500_btn, output_500_text]
|
510 |
)
|
@@ -514,7 +514,6 @@ def gradio_interface():
|
|
514 |
|
515 |
|
516 |
|
517 |
-
|
518 |
if __name__ == "__main__":
|
519 |
try:
|
520 |
logger.info("Starting application initialization...")
|
|
|
382 |
|
383 |
if top_500:
|
384 |
# Generate the top 500 list
|
385 |
+
result = ", ".join([f"'{token}': {value:.4f}" for token, value in closest_tokens_with_values])
|
386 |
logger.info("Returning top 500 list")
|
387 |
return result, None
|
388 |
else:
|
|
|
487 |
inputs=inputs,
|
488 |
outputs=[output_text, output_image],
|
489 |
show_progress="full"
|
490 |
+
).then(lambda: (gr.update(visible=False), gr.update(value="")), None, [generate_top_500_btn, output_500_text])
|
491 |
|
492 |
generate_top_500_btn.click(
|
493 |
generate_top_500,
|
494 |
inputs=inputs,
|
495 |
outputs=[output_500_text],
|
496 |
show_progress="full"
|
497 |
+
).then(lambda: gr.update(visible=True), None, [output_500_text])
|
498 |
|
499 |
trim_btn.click(trim_tree, inputs=[trim_slider, tree_data_state], outputs=[output_image])
|
500 |
|
|
|
504 |
feature_number.change(update_neuronpedia, inputs=[selected_sae, feature_number], outputs=[neuronpedia_html])
|
505 |
|
506 |
output_text.change(
|
507 |
+
lambda text: (gr.update(visible=True), gr.update(visible=True)) if "100 tokens" in text else (gr.update(visible=False), gr.update(visible=False)),
|
508 |
inputs=[output_text],
|
509 |
outputs=[generate_top_500_btn, output_500_text]
|
510 |
)
|
|
|
514 |
|
515 |
|
516 |
|
|
|
517 |
if __name__ == "__main__":
|
518 |
try:
|
519 |
logger.info("Starting application initialization...")
|