PeterPinetree commited on
Commit
d79b10f
·
verified ·
1 Parent(s): 775aa53

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
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) # clean label
234
  label = fmt_row(i, prob, tid, tok_disp)
235
- solara.Button(
236
- label,
237
- on_click=lambda tid=tid: append_token(tid),
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