corasan commited on
Commit
9fc7882
1 Parent(s): 805422f

Update app.py

Browse files

highlighting the token boundaries

Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -11,7 +11,7 @@ examples = [
11
  def greet(sentence):
12
  sp = spm.SentencePieceProcessor()
13
  sp.load('bpe.model')
14
- return " • ".join(sp.encode_as_pieces(sentence))
15
 
16
 
17
  demo = gr.Interface(fn=greet, inputs="text", outputs="html",
@@ -19,5 +19,5 @@ demo = gr.Interface(fn=greet, inputs="text", outputs="html",
19
  description="Demo for SentencePiece BPE.",
20
  cache_examples="lazy",
21
  concurrency_limit=30,
22
- css="textarea {font-size: 150%;}")
23
  demo.launch()
 
11
  def greet(sentence):
12
  sp = spm.SentencePieceProcessor()
13
  sp.load('bpe.model')
14
+ return "<div class='output'>" + "<span class='yellow'> </span>".join(sp.encode_as_pieces(sentence)) + "</div>"
15
 
16
 
17
  demo = gr.Interface(fn=greet, inputs="text", outputs="html",
 
19
  description="Demo for SentencePiece BPE.",
20
  cache_examples="lazy",
21
  concurrency_limit=30,
22
+ css=".output {font-size: 150%;}; .yellow {background-color: yellow; }")
23
  demo.launch()