Jellyfish042 commited on
Commit
dd97139
1 Parent(s): d15d649

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -4,13 +4,6 @@ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
4
  tokenizer = AutoTokenizer.from_pretrained("google/mt5-small")
5
  model = AutoModelForSeq2SeqLM.from_pretrained("./checkpoint-15000/")
6
 
7
- examples = [
8
- ["猪笼草原产于热带和亚热带地区 现主要分布在东南亚一带 中国广东 广西等地有分布 猪笼草喜欢湿润和温暖半阴的生长环境 不耐寒 怕积水 怕强光 怕干燥 喜欢疏松 肥沃和透气的腐叶土和泥炭土 对光照要求较为严格 猪笼草的繁殖方式包括扦插繁殖 压条繁殖和播种繁殖"],
9
-
10
- ]
11
-
12
- inputs=[gr.inputs.Textbox(default=examples[0][0], label="输入文本")]
13
-
14
  def text_processing(text):
15
  inputs = [text]
16
 
@@ -26,10 +19,18 @@ def text_processing(text):
26
 
27
  return decoded_output[0]
28
 
 
 
 
 
 
 
 
 
29
  iface = gr.Interface(
30
  fn=text_processing,
31
  inputs=[gr.inputs.Textbox(default=examples[0][0], label="输入文本")],
32
- outputs='',
33
  title='Punctuation Mark Prediction',
34
  description='本模型主要用于语言识别模型输出的后处理。\n输入无符号句子,需要打标点处用空格隔开,返回带标点句子。\n仅支持中文,因为训练数据中只有中文。',
35
  examples=examples
 
4
  tokenizer = AutoTokenizer.from_pretrained("google/mt5-small")
5
  model = AutoModelForSeq2SeqLM.from_pretrained("./checkpoint-15000/")
6
 
 
 
 
 
 
 
 
7
  def text_processing(text):
8
  inputs = [text]
9
 
 
19
 
20
  return decoded_output[0]
21
 
22
+ examples = [
23
+ ["猪笼草原产于热带和亚热带地区 现主要分布在东南亚一带 中国广东 广西等地有分布 猪笼草喜欢湿润和温暖半阴的生长环境 不耐寒 怕积水 怕强光 怕干燥 喜欢疏松 肥沃和透气的腐叶土和泥炭土 对光照要求较为严格 猪笼草的繁殖方式包括扦插繁殖 压条繁殖和播种繁殖"],
24
+ ["都什么年代了 还在抽传统香烟"]
25
+ ]
26
+
27
+ inputs=[gr.inputs.Textbox(default=examples[0][0], label="输入文本")]
28
+
29
+
30
  iface = gr.Interface(
31
  fn=text_processing,
32
  inputs=[gr.inputs.Textbox(default=examples[0][0], label="输入文本")],
33
+ outputs='text',
34
  title='Punctuation Mark Prediction',
35
  description='本模型主要用于语言识别模型输出的后处理。\n输入无符号句子,需要打标点处用空格隔开,返回带标点句子。\n仅支持中文,因为训练数据中只有中文。',
36
  examples=examples