Spaces:
Running
Running
Update app.py
#20
by
aaronsu
- opened
app.py
CHANGED
@@ -170,7 +170,8 @@ with st.expander("配置"):
|
|
170 |
|
171 |
if st.checkbox("使用换行符作为截断", value=False):
|
172 |
stop_tokens = "\n"
|
173 |
-
|
|
|
174 |
def completion():
|
175 |
try:
|
176 |
resp = requests.post("https://welm.weixin.qq.com/v1/completions", json={
|
@@ -181,6 +182,7 @@ def completion():
|
|
181 |
'top_k': top_k,
|
182 |
'n': n,
|
183 |
'model': model,
|
|
|
184 |
}, headers={"Authorization": f"Bearer {st.secrets['token']}"})
|
185 |
answer = resp.json()
|
186 |
for idx, choice in enumerate(answer['choices']):
|
|
|
170 |
|
171 |
if st.checkbox("使用换行符作为截断", value=False):
|
172 |
stop_tokens = "\n"
|
173 |
+
if task_type == 'FREE':
|
174 |
+
stop_tokens = ""
|
175 |
def completion():
|
176 |
try:
|
177 |
resp = requests.post("https://welm.weixin.qq.com/v1/completions", json={
|
|
|
182 |
'top_k': top_k,
|
183 |
'n': n,
|
184 |
'model': model,
|
185 |
+
"stop": stop_tokens,
|
186 |
}, headers={"Authorization": f"Bearer {st.secrets['token']}"})
|
187 |
answer = resp.json()
|
188 |
for idx, choice in enumerate(answer['choices']):
|