genne
commited on
Commit
•
494b413
0
Parent(s):
initial commit
Browse files
app.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from kiwipiepy import Kiwi
|
3 |
+
|
4 |
+
kiwi = Kiwi(model_type='sbg', typos='basic')
|
5 |
+
|
6 |
+
def correct(input: str) -> str:
|
7 |
+
input = kiwi.glue(input.split("\n"))
|
8 |
+
sentence = kiwi.space(input)
|
9 |
+
tokens = kiwi.tokenize(sentence)
|
10 |
+
return kiwi.join(tokens)
|
11 |
+
|
12 |
+
if __name__ == '__main__':
|
13 |
+
with gr.Blocks(title='귀여운교정기') as demo:
|
14 |
+
with gr.Row():
|
15 |
+
with gr.Column():
|
16 |
+
input_text = gr.Textbox()
|
17 |
+
btn = gr.Button()
|
18 |
+
output_text = gr.Textbox()
|
19 |
+
|
20 |
+
btn.click(correct, inputs=[input_text], outputs=output_text)
|
21 |
+
example = """배고픈
|
22 |
+
데밥
|
23 |
+
시간좀알려 줘"""
|
24 |
+
examples = gr.Examples([example], inputs=input_text)
|
25 |
+
|
26 |
+
demo.launch(
|
27 |
+
server_port=7007,
|
28 |
+
server_name='0.0.0.0',
|
29 |
+
debug=False,
|
30 |
+
)
|