import gradio as gr def Chinese_tokenization(txt): from LAC import LAC # 装载分词模型 lac = LAC(mode='seg') # 单个样本输入,输入为Unicode编码的字符串 seg_result = lac.run(txt) output="" for i in seg_result: output= output + " " + i + " " return(output) demo = gr.Interface(fn=Chinese_tokenization, inputs="text", outputs="text", description="Chinese Word Segmentation Using Baidu's LAC") demo.launch()