taishi-i commited on
Commit
7d2250e
1 Parent(s): ccea3f9

add application file

Browse files
Files changed (2) hide show
  1. app.py +36 -0
  2. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import nagisa
3
+
4
+
5
+ def tokenize(text):
6
+ tokens = nagisa.tagging(text)
7
+ return tokens.words, tokens.postags
8
+
9
+
10
+ num_input_lines = 3
11
+ input_placeholder = "Please input text here."
12
+ title = "Japanese tokenization demo"
13
+ default_text = "ここにテキストを入力し、Submit を押してください。"
14
+ description = (
15
+ "This is a demo page for nagisa's tokenization. By entering text into the"
16
+ " text box, you can verify the output results of nagisa. nagisa provides"
17
+ " an easy-to-use feature for word segmentation and part-of-speech tagging"
18
+ " in Japanese text. https://github.com/taishi-i/nagisa"
19
+ )
20
+ examples = ["Pythonで簡単に使えるツールです", "3月に見た「3月のライオン」", "福岡・博多の観光情報"]
21
+
22
+ iface = gr.Interface(
23
+ fn=tokenize,
24
+ inputs=gr.inputs.Textbox(
25
+ lines=num_input_lines,
26
+ placeholder=input_placeholder,
27
+ default=default_text,
28
+ ),
29
+ title=title,
30
+ description=description,
31
+ examples=examples,
32
+ outputs=["text", "text"],
33
+ )
34
+
35
+
36
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ nagisa