suolyer commited on
Commit
b5c067b
1 Parent(s): 40f89f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -9
app.py CHANGED
@@ -698,17 +698,22 @@ def main():
698
 
699
  st.info("Please input the following information「请输入以下信息...」")
700
  model_type = st.selectbox('Select task type「选择任务类型」',['Text classification「文本分类」','Sentiment「情感分析」','Similarity「语义匹配」','NLI 「自然语言推理」','Multiple Choice「多项式阅读理解」'])
701
-
702
  if '中文' in language:
703
- sentences = st.text_area("Please input the context「请输入句子」", text_dict[model_type])
704
- question = st.text_input("Please input the question「请输入问题(不输入问题也可以)」", question_dict[model_type])
705
- choice = st.text_input("Please input the label「输入标签(以中文;分割)」", choice_dict[model_type])
706
  else:
707
- sentences = st.text_area("Please input the context「请输入句子」", text_dict_en[model_type])
708
- question = st.text_input("Please input the question「请输入问题(不输入问题也可以)」", question_dict_en[model_type])
709
- choice = st.text_input("Please input the label「输入标签(以中文;分割)」", choice_dict[model_type])
 
 
710
 
711
- choice = choice.split('')
 
 
 
712
 
713
  data = [{"texta": sentences,
714
  "textb": "",
@@ -722,7 +727,7 @@ def main():
722
  result = model.predict(data, cuda=False)
723
  st.success(f"Prediction is successful, consumes {str(time.time()-start)} seconds")
724
  st.json(result[0])
725
- st.form_submit_button("Submit「点击一下,开始预测!」")
726
 
727
 
728
 
 
698
 
699
  st.info("Please input the following information「请输入以下信息...」")
700
  model_type = st.selectbox('Select task type「选择任务类型」',['Text classification「文本分类」','Sentiment「情感分析」','Similarity「语义匹配」','NLI 「自然语言推理」','Multiple Choice「多项式阅读理解」'])
701
+ form = st.form("参数设置")
702
  if '中文' in language:
703
+ sentences = form.text_area("Please input the context「请输入句子」", text_dict[model_type])
704
+ question = form.text_input("Please input the question「请输入问题(不输入问题也可以)」", question_dict[model_type])
705
+ choice = form.text_input("Please input the label「输入标签(以中文;分割)」", choice_dict[model_type])
706
  else:
707
+ sentences = form.text_area("Please input the context「请输入句子」", text_dict_en[model_type])
708
+ question = form.text_input("Please input the question「请输入问题(不输入问题也可以)」", question_dict_en[model_type])
709
+ choice = form.text_input("Please input the label(split by ‘;’)「输入标签(以中文;分割)」", choice_dict_en[model_type])
710
+
711
+ form.form_submit_button("Submit「点击一下,开始预测!」")
712
 
713
+ if '中文' in language:
714
+ choice = choice.split(';')
715
+ else:
716
+ choice = choice.split(';')
717
 
718
  data = [{"texta": sentences,
719
  "textb": "",
 
727
  result = model.predict(data, cuda=False)
728
  st.success(f"Prediction is successful, consumes {str(time.time()-start)} seconds")
729
  st.json(result[0])
730
+
731
 
732
 
733