Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -1176,49 +1176,58 @@ with gr.Blocks(title="PTS Visualizer", css=CSS) as demo:
|
|
| 1176 |
circuit_html = gr.HTML()
|
| 1177 |
circuit_chart = gr.Plot()
|
| 1178 |
|
| 1179 |
-
# Event handlers
|
| 1180 |
load_btn.click(
|
| 1181 |
fn=load_dataset_action,
|
| 1182 |
inputs=[source_type, dataset_dropdown, file_upload],
|
| 1183 |
-
outputs=[load_status, dataset_info]
|
|
|
|
| 1184 |
).then(
|
| 1185 |
fn=refresh_all,
|
| 1186 |
-
outputs=[stats_html, stats_chart, graph_plot, embed_plot, circuit_html, circuit_chart]
|
|
|
|
| 1187 |
).then(
|
| 1188 |
fn=lambda: gr.update(maximum=max(0, len(current_data["df"]) - 1)),
|
| 1189 |
-
outputs=[token_slider]
|
|
|
|
| 1190 |
).then(
|
| 1191 |
fn=get_query_list,
|
| 1192 |
-
outputs=[query_filter]
|
|
|
|
| 1193 |
)
|
| 1194 |
|
| 1195 |
refresh_btn.click(
|
| 1196 |
fn=refresh_all,
|
| 1197 |
-
outputs=[stats_html, stats_chart, graph_plot, embed_plot, circuit_html, circuit_chart]
|
|
|
|
| 1198 |
)
|
| 1199 |
|
| 1200 |
token_slider.change(
|
| 1201 |
fn=get_token_details,
|
| 1202 |
inputs=[token_slider],
|
| 1203 |
-
outputs=[token_html, prob_chart]
|
|
|
|
| 1204 |
)
|
| 1205 |
|
| 1206 |
query_filter.change(
|
| 1207 |
fn=update_graph_visualization,
|
| 1208 |
inputs=[query_filter],
|
| 1209 |
-
outputs=[graph_plot]
|
|
|
|
| 1210 |
)
|
| 1211 |
|
| 1212 |
color_dropdown.change(
|
| 1213 |
fn=update_embedding_visualization,
|
| 1214 |
inputs=[color_dropdown],
|
| 1215 |
-
outputs=[embed_plot]
|
|
|
|
| 1216 |
)
|
| 1217 |
|
| 1218 |
circuit_query_idx.change(
|
| 1219 |
fn=update_circuit_view,
|
| 1220 |
inputs=[circuit_query_idx],
|
| 1221 |
-
outputs=[circuit_html, circuit_chart]
|
|
|
|
| 1222 |
)
|
| 1223 |
|
| 1224 |
|
|
|
|
| 1176 |
circuit_html = gr.HTML()
|
| 1177 |
circuit_chart = gr.Plot()
|
| 1178 |
|
| 1179 |
+
# Event handlers - using api_name=False to prevent schema generation issues
|
| 1180 |
load_btn.click(
|
| 1181 |
fn=load_dataset_action,
|
| 1182 |
inputs=[source_type, dataset_dropdown, file_upload],
|
| 1183 |
+
outputs=[load_status, dataset_info],
|
| 1184 |
+
api_name=False
|
| 1185 |
).then(
|
| 1186 |
fn=refresh_all,
|
| 1187 |
+
outputs=[stats_html, stats_chart, graph_plot, embed_plot, circuit_html, circuit_chart],
|
| 1188 |
+
api_name=False
|
| 1189 |
).then(
|
| 1190 |
fn=lambda: gr.update(maximum=max(0, len(current_data["df"]) - 1)),
|
| 1191 |
+
outputs=[token_slider],
|
| 1192 |
+
api_name=False
|
| 1193 |
).then(
|
| 1194 |
fn=get_query_list,
|
| 1195 |
+
outputs=[query_filter],
|
| 1196 |
+
api_name=False
|
| 1197 |
)
|
| 1198 |
|
| 1199 |
refresh_btn.click(
|
| 1200 |
fn=refresh_all,
|
| 1201 |
+
outputs=[stats_html, stats_chart, graph_plot, embed_plot, circuit_html, circuit_chart],
|
| 1202 |
+
api_name=False
|
| 1203 |
)
|
| 1204 |
|
| 1205 |
token_slider.change(
|
| 1206 |
fn=get_token_details,
|
| 1207 |
inputs=[token_slider],
|
| 1208 |
+
outputs=[token_html, prob_chart],
|
| 1209 |
+
api_name=False
|
| 1210 |
)
|
| 1211 |
|
| 1212 |
query_filter.change(
|
| 1213 |
fn=update_graph_visualization,
|
| 1214 |
inputs=[query_filter],
|
| 1215 |
+
outputs=[graph_plot],
|
| 1216 |
+
api_name=False
|
| 1217 |
)
|
| 1218 |
|
| 1219 |
color_dropdown.change(
|
| 1220 |
fn=update_embedding_visualization,
|
| 1221 |
inputs=[color_dropdown],
|
| 1222 |
+
outputs=[embed_plot],
|
| 1223 |
+
api_name=False
|
| 1224 |
)
|
| 1225 |
|
| 1226 |
circuit_query_idx.change(
|
| 1227 |
fn=update_circuit_view,
|
| 1228 |
inputs=[circuit_query_idx],
|
| 1229 |
+
outputs=[circuit_html, circuit_chart],
|
| 1230 |
+
api_name=False
|
| 1231 |
)
|
| 1232 |
|
| 1233 |
|