Spaces:
Running
Running
File size: 1,182 Bytes
7d2250e a0783ba 4fc24ec 743d68a 4fc24ec ac4ddfc 7d2250e 6fd2f10 743d68a 7d2250e f6ac75e 7d2250e 743d68a f6ac75e 743d68a 356f076 7d2250e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
import gradio as gr
import nagisa
def tokenize(text):
tokens = nagisa.tagging(text)
return tokens.words, tokens.postags
num_input_lines = 3
input_placeholder = "Please input text here."
title = "Japanese tokenization demo"
default_text = "ここにテキストを入力し、Enter を押してください。"
description = """
This is a demo page for nagisa's tokenization.
Nagisa is a Python module used for tokenizing and performing Part-of-Speech (POS) tagging on Japanese text.
It is designed to be a simple and easy-to-use tool.
To try it out, enter some text in the box below and press submit.
https://github.com/taishi-i/nagisa
"""
examples = ["Pythonで簡単に使えるツールです", "3月に見た「3月のライオン」", "福岡・博多の観光情報"]
iface = gr.Interface(
fn=tokenize,
inputs=gr.Textbox(
label="Input text",
lines=num_input_lines,
placeholder=input_placeholder,
value=default_text,
),
title=title,
description=description,
examples=examples,
outputs=[
gr.Textbox(label="Words"),
gr.Textbox(label="POS tags"),
],
live=True,
)
iface.launch()
|