cazzz307 commited on
Commit
3ce26bb
·
verified ·
1 Parent(s): 3fae030

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -212,10 +212,17 @@ EXAMPLE_TEXTS = [
212
  "I love eating [MASK] with tomato sauce.",
213
  "The [MASK] barked loudly at the stranger."
214
  ]
 
 
 
 
 
 
 
 
 
 
215
 
216
- with gr.Blocks(css="""
217
- #tokens-html { font-family: 'JetBrains Mono', monospace; }
218
- """) as demo:
219
  gr.Markdown(DESCRIPTION)
220
 
221
  with gr.Row():
@@ -258,7 +265,7 @@ with gr.Blocks(css="""
258
  outputs=[tokens_html, pred_out, prob_plot, att_plot, info_box],
259
  )
260
 
261
- # Also run on change for a smoother experience
262
  text_in.change(
263
  analyze,
264
  inputs=[text_in, layer_slider],
@@ -270,5 +277,6 @@ with gr.Blocks(css="""
270
  outputs=[tokens_html, pred_out, prob_plot, att_plot, info_box],
271
  )
272
 
 
273
  if __name__ == "__main__":
274
  demo.launch()
 
212
  "I love eating [MASK] with tomato sauce.",
213
  "The [MASK] barked loudly at the stranger."
214
  ]
215
+ with gr.Blocks() as demo:
216
+
217
+ # Optional styling (safe even on older Gradio versions)
218
+ gr.HTML("""
219
+ <style>
220
+ #tokens-html {
221
+ font-family: "JetBrains Mono", monospace;
222
+ }
223
+ </style>
224
+ """)
225
 
 
 
 
226
  gr.Markdown(DESCRIPTION)
227
 
228
  with gr.Row():
 
265
  outputs=[tokens_html, pred_out, prob_plot, att_plot, info_box],
266
  )
267
 
268
+ # Allows instant update without clicking Run
269
  text_in.change(
270
  analyze,
271
  inputs=[text_in, layer_slider],
 
277
  outputs=[tokens_html, pred_out, prob_plot, att_plot, info_box],
278
  )
279
 
280
+
281
  if __name__ == "__main__":
282
  demo.launch()