File size: 748 Bytes
494b413
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63e8db7
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
import gradio as gr
from kiwipiepy import Kiwi

kiwi = Kiwi(model_type='sbg', typos='basic')

def correct(input: str) -> str:
    input = kiwi.glue(input.split("\n"))
    sentence = kiwi.space(input)
    tokens = kiwi.tokenize(sentence)
    return kiwi.join(tokens)

if __name__ == '__main__':    
    with gr.Blocks(title='귀여운교정기') as demo:
        with gr.Row():
            with gr.Column():
                input_text = gr.Textbox()
                btn = gr.Button()
            output_text = gr.Textbox()

        btn.click(correct, inputs=[input_text], outputs=output_text)
        example = """배고픈
        데밥
        시간좀알려 줘"""
        examples = gr.Examples([example], inputs=input_text)

    demo.launch()