Spaces:
Sleeping
Sleeping
Commit
·
260c79f
1
Parent(s):
99753cb
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,24 @@
|
|
| 1 |
from pythainlp.tokenize import word_tokenize
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
-
def cut_word(text):
|
| 5 |
-
return
|
| 6 |
|
| 7 |
-
iface = gr.Interface(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
iface.launch()
|
|
|
|
| 1 |
from pythainlp.tokenize import word_tokenize
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
def cut_word(text,separate):
|
| 5 |
+
return str(separate).join(word_tokenize(text))
|
| 6 |
|
| 7 |
+
iface = gr.Interface(
|
| 8 |
+
fn=cut_word,
|
| 9 |
+
inputs=[
|
| 10 |
+
gr.Textbox(
|
| 11 |
+
label="Text",
|
| 12 |
+
info="Thai Text",
|
| 13 |
+
lines=3,
|
| 14 |
+
#value="The quick brown fox jumped over the lazy dogs.",
|
| 15 |
+
),
|
| 16 |
+
gr.Textbox(
|
| 17 |
+
label="Separate",
|
| 18 |
+
info="Word or symbol for word tokenization",
|
| 19 |
+
#lines=3,
|
| 20 |
+
value="|",
|
| 21 |
+
),
|
| 22 |
+
],
|
| 23 |
+
outputs="textbox")
|
| 24 |
iface.launch()
|