Spaces:
Running
Running
Update app.py
Browse fileshighlighting the token boundaries
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="
|
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()
|