Turkeyengineer commited on
Commit
701a9c4
·
verified ·
1 Parent(s): 063f93a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -1,9 +1,14 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- if not name:
5
- return "請輸入名字!"
6
- return f"你好,{name}!很高興認識你。"
7
 
8
- demo = gr.Interface(fn=greet, inputs="text", outputs="text", title="問候產生器", description="輸入你的名字,看看我怎麼回應你!")
 
 
 
 
 
 
9
  demo.launch()
 
1
  import gradio as gr
2
 
3
+ def segment(text):
4
+ # 示意:將中文句子依字分開(暫代斷詞功能)
5
+ return " / ".join(list(text))
 
6
 
7
+ demo = gr.Interface(
8
+ fn=segment,
9
+ inputs=gr.Textbox(lines=2, placeholder="輸入一段中文..."),
10
+ outputs="text",
11
+ title="中文斷詞模擬器",
12
+ description="這是一個簡易的中文斷詞工具,未來將整合 CKIP 模型。"
13
+ )
14
  demo.launch()