Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -230,17 +230,20 @@ def PredictionsList():
|
|
| 230 |
for i, row in df.iterrows():
|
| 231 |
tid = int(row["id"])
|
| 232 |
prob = row["probs"]
|
| 233 |
-
tok_disp = display_token_from_id(tid)
|
| 234 |
label = fmt_row(i, prob, tid, tok_disp)
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
on_mouse_enter=lambda tid=tid: preview_token(tid), # newer solara
|
| 239 |
-
on_mouse_over=lambda tid=tid: preview_token(tid), # older solara
|
| 240 |
-
on_focus=lambda tid=tid: preview_token(tid), # keyboard
|
| 241 |
classes=["rowbtn"],
|
| 242 |
style={"justifyContent": "flex-start"},
|
| 243 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 244 |
|
| 245 |
# ------------------ Page ------------------
|
| 246 |
@solara.component
|
|
|
|
| 230 |
for i, row in df.iterrows():
|
| 231 |
tid = int(row["id"])
|
| 232 |
prob = row["probs"]
|
| 233 |
+
tok_disp = display_token_from_id(tid)
|
| 234 |
label = fmt_row(i, prob, tid, tok_disp)
|
| 235 |
+
|
| 236 |
+
# Use Div instead of Button so hover works everywhere
|
| 237 |
+
with solara.Div(
|
|
|
|
|
|
|
|
|
|
| 238 |
classes=["rowbtn"],
|
| 239 |
style={"justifyContent": "flex-start"},
|
| 240 |
+
on_click=lambda tid=tid: append_token(tid),
|
| 241 |
+
on_mouse_enter=lambda tid=tid: preview_token(tid),
|
| 242 |
+
on_mouse_over=lambda tid=tid: preview_token(tid),
|
| 243 |
+
on_focus=lambda tid=tid: preview_token(tid),
|
| 244 |
+
attributes={"tabindex": "0"}, # keyboard focusable
|
| 245 |
+
):
|
| 246 |
+
solara.Text(label)
|
| 247 |
|
| 248 |
# ------------------ Page ------------------
|
| 249 |
@solara.component
|