File size: 453 Bytes
d94a67e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
047aa3d
d94a67e
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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()