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( server_port=7007, server_name='0.0.0.0', debug=False, )