Spaces:
Sleeping
Sleeping
Constantin Orasan
commited on
Commit
·
8bf71a3
1
Parent(s):
e292284
Added the actual processing
Browse files
app.py
CHANGED
|
@@ -1,7 +1,12 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
def greet(name):
|
| 4 |
-
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import sentencepiece as spm
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def greet(sentence):
|
| 6 |
+
sp = spm.SentencePieceProcessor()
|
| 7 |
+
sp.load('bpe.model')
|
| 8 |
+
return " ".join(sp.encode_as_pieces(sentence))
|
| 9 |
|
|
|
|
|
|
|
| 10 |
|
| 11 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 12 |
demo.launch()
|
bpe.model
ADDED
|
Binary file (316 kB). View file
|
|
|