WesScivetti commited on
Commit
dec77c7
·
2 Parent(s): 0401c86 38902a5
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -6,6 +6,8 @@ from transformers import pipeline, AutoTokenizer, AutoModelForTokenClassificatio
6
  import torch
7
  import numpy as np
8
 
 
 
9
  #Description text for the Gradio interface
10
  DESCR_TOP = """
11
  <h1 style="text-align: center">SNACS Tagging</h1>
@@ -361,7 +363,7 @@ def classify_tokens(text: str, use_canned=False):
361
 
362
 
363
  #final rendering of the Gradio interface
364
- with gr.Blocks(title="SNACS Tagging") as demo:
365
  with gr.Row():
366
  description = gr.HTML(DESCR_TOP)
367
 
@@ -392,6 +394,7 @@ with gr.Blocks(title="SNACS Tagging") as demo:
392
  json_tokens = gr.Code(language="json")
393
 
394
  examples.outputs = [simple_output,json_spans,json_tokens,output1,output2,output3]
 
395
  tag_btn.click(fn=classify_tokens, inputs=input_text, outputs=examples.outputs)
396
 
397
 
 
6
  import torch
7
  import numpy as np
8
 
9
+ CUSTOM_CSS = ".textspan { word-break: break-word; white-space: nowrap } /* keep span and tag all on one line */ "
10
+
11
  #Description text for the Gradio interface
12
  DESCR_TOP = """
13
  <h1 style="text-align: center">SNACS Tagging</h1>
 
363
 
364
 
365
  #final rendering of the Gradio interface
366
+ with gr.Blocks(title="SNACS Tagging", css=CUSTOM_CSS) as demo:
367
  with gr.Row():
368
  description = gr.HTML(DESCR_TOP)
369
 
 
394
  json_tokens = gr.Code(language="json")
395
 
396
  examples.outputs = [simple_output,json_spans,json_tokens,output1,output2,output3]
397
+ examples.cache_examples = True
398
  tag_btn.click(fn=classify_tokens, inputs=input_text, outputs=examples.outputs)
399
 
400