Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -60,6 +60,7 @@ Elon Musk:""",
60
 
61
  prompt = task2prompt[Task[task_type]]
62
  all_input = st.text_area('模型输入', value=prompt, height=400)
 
63
 
64
 
65
  with st.expander("配置"):
@@ -81,7 +82,7 @@ with st.expander("配置"):
81
  elif task_type == 'COMPLETION':
82
  default_top_p, default_temperature, default_n, default_tokens = 0.95, 0.85, 1, 150
83
  else:
84
- default_top_p, default_temperature, default_n, default_tokens = 0.95, 0.85, 5, 64
85
 
86
  model = st.selectbox("model", ["medium", "large", "xl"], index=2)
87
  top_p = st.slider('top p', 0.0, 1.0, default_top_p)
@@ -111,6 +112,8 @@ def completion():
111
  st.error(f'生成结果#{idx}出错: {choice["finish_reason"]}')
112
  elif choice.get("text", None) is None:
113
  st.error(f'生成结果#{idx}出错: 无生成结果')
 
 
114
  else:
115
  st.success(f'生成结果#{idx}: {cut_message(choice["text"])}')
116
 
@@ -139,7 +142,6 @@ background-color: transparent;
139
  text-decoration: underline;
140
  }
141
 
142
-
143
  .footer {
144
  position: relative;
145
  left: 0;
@@ -163,4 +165,4 @@ text-align: left;
163
  欲了解更多信息,请阅读我们的<a href="https://welm.weixin.qq.com/docs/license/" target="_blank">《服务使用协议》和《免责声明》</a>。</p>
164
  </div>
165
  """
166
- st.markdown(footer,unsafe_allow_html=True)
 
60
 
61
  prompt = task2prompt[Task[task_type]]
62
  all_input = st.text_area('模型输入', value=prompt, height=400)
63
+ all_input = all_input.rstrip('\\n')
64
 
65
 
66
  with st.expander("配置"):
 
82
  elif task_type == 'COMPLETION':
83
  default_top_p, default_temperature, default_n, default_tokens = 0.95, 0.85, 1, 150
84
  else:
85
+ default_top_p, default_temperature, default_n, default_tokens = 0.95, 0.85, 3, 64
86
 
87
  model = st.selectbox("model", ["medium", "large", "xl"], index=2)
88
  top_p = st.slider('top p', 0.0, 1.0, default_top_p)
 
112
  st.error(f'生成结果#{idx}出错: {choice["finish_reason"]}')
113
  elif choice.get("text", None) is None:
114
  st.error(f'生成结果#{idx}出错: 无生成结果')
115
+ elif len(choice.get("text", "")) == 0:
116
+ st.info(f'生成结果#{idx}: 生成结果为空')
117
  else:
118
  st.success(f'生成结果#{idx}: {cut_message(choice["text"])}')
119
 
 
142
  text-decoration: underline;
143
  }
144
 
 
145
  .footer {
146
  position: relative;
147
  left: 0;
 
165
  欲了解更多信息,请阅读我们的<a href="https://welm.weixin.qq.com/docs/license/" target="_blank">《服务使用协议》和《免责声明》</a>。</p>
166
  </div>
167
  """
168
+ st.markdown(footer,unsafe_allow_html=True)