yowenchen commited on
Commit
45332cc
1 Parent(s): 46a5c12
Files changed (1) hide show
  1. app.py +11 -5
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,6 +142,9 @@ background-color: transparent;
139
  text-decoration: underline;
140
  }
141
 
 
 
 
142
 
143
  .footer {
144
  position: relative;
@@ -150,17 +156,17 @@ color: rgb(18 19 23 / 80%);
150
  text-align: left;
151
  }
152
  </style>
153
- <div class="footer" style="font-size:12px">
154
  <br>
155
  <br>
156
  <br>
157
  <br>
158
  <br>
159
- <p style="font-size:12px">声明(受<a href="https://beta.openai.com/docs/usage-guidelines/content-policy" target="_blank"> OpenAI GPT3's Content Policy </a>启发)</p>
160
 
161
- <p style="font-size:12px">我们禁止用户在知情的情况下产生或利用他人在知情的情况下产生有害内容,包括且不限于仇恨言论、骚扰信息、自我伤害内容、性内容、政治内容、垃圾邮件、诈骗信息等。<br>
162
  特别提示:本网页上产生的所有内容不代表本平台的观点和意见。<br>
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
+ p {
146
+ font-size:12px;
147
+ }
148
 
149
  .footer {
150
  position: relative;
 
156
  text-align: left;
157
  }
158
  </style>
159
+ <div class="footer">
160
  <br>
161
  <br>
162
  <br>
163
  <br>
164
  <br>
165
+ <p style="font-size:12px">免责声明(受<a href="https://beta.openai.com/docs/usage-guidelines/content-policy" target="_blank"> OpenAI GPT3's Content Policy </a>启发)</p>
166
 
167
+ <p>我们禁止用户在知情的情况下产生或利用他人在知情的情况下产生有害内容,包括且不限于仇恨言论、骚扰信息、自我伤害内容、性内容、政治内容、垃圾邮件、诈骗信息等。<br>
168
  特别提示:本网页上产生的所有内容不代表本平台的观点和意见。<br>
169
  欲了解更多信息,请阅读我们的<a href="https://welm.weixin.qq.com/docs/license/" target="_blank">《服务使用协议》和《免责声明》</a>。</p>
170
  </div>
171
  """
172
+ st.markdown(footer,unsafe_allow_html=True)