Spaces:
Running
Running
Constantin Orasan
commited on
Commit
•
949e724
1
Parent(s):
98f635a
Added examples
Browse files
app.py
CHANGED
@@ -1,6 +1,12 @@
|
|
1 |
import gradio as gr
|
2 |
import sentencepiece as spm
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
def greet(sentence):
|
6 |
sp = spm.SentencePieceProcessor()
|
@@ -8,5 +14,9 @@ def greet(sentence):
|
|
8 |
return " ".join(sp.encode_as_pieces(sentence))
|
9 |
|
10 |
|
11 |
-
demo = gr.Interface(fn=greet, inputs="text", outputs="text"
|
|
|
|
|
|
|
|
|
12 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
import sentencepiece as spm
|
3 |
|
4 |
+
examples = [
|
5 |
+
"Hello, world!",
|
6 |
+
"This is a test.",
|
7 |
+
"The Page title option has a text input box for changing the title of the image gallery page.",
|
8 |
+
"Algoritmos de diseño de árboles"]
|
9 |
+
|
10 |
|
11 |
def greet(sentence):
|
12 |
sp = spm.SentencePieceProcessor()
|
|
|
14 |
return " ".join(sp.encode_as_pieces(sentence))
|
15 |
|
16 |
|
17 |
+
demo = gr.Interface(fn=greet, inputs="text", outputs="text",
|
18 |
+
examples=examples, title="SentencePiece BPE",
|
19 |
+
description="This is a demo for SentencePiece BPE.",
|
20 |
+
cache_examples="lazy",
|
21 |
+
concurrency_limit=30)
|
22 |
demo.launch()
|