Spaces:
Running
Running
yowenchen
commited on
Commit
•
24bc724
1
Parent(s):
6920ca8
update
Browse files
app.py
CHANGED
@@ -63,7 +63,7 @@ all_input = st.text_area('模型输入', value=prompt, height=400)
|
|
63 |
|
64 |
|
65 |
with st.expander("配置"):
|
66 |
-
stop_tokens =
|
67 |
def cut_message(answer: str):
|
68 |
end = []
|
69 |
for etk in stop_tokens:
|
@@ -91,7 +91,7 @@ with st.expander("配置"):
|
|
91 |
max_tokens = st.slider('max tokens', 4, 512, default_tokens)
|
92 |
|
93 |
if st.checkbox("使用换行符作为截断", value=True):
|
94 |
-
stop_tokens
|
95 |
|
96 |
def completion():
|
97 |
resp = requests.post("https://welm.weixin.qq.com/v1/completions", json={
|
@@ -101,7 +101,8 @@ def completion():
|
|
101 |
'top_p': top_p,
|
102 |
'top_k': top_k,
|
103 |
'n': n,
|
104 |
-
'model': model
|
|
|
105 |
}, headers={"Authorization": f"Bearer {st.secrets['token']}"})
|
106 |
answer = resp.json()
|
107 |
for idx, choice in enumerate(answer['choices']):
|
|
|
63 |
|
64 |
|
65 |
with st.expander("配置"):
|
66 |
+
stop_tokens = ""
|
67 |
def cut_message(answer: str):
|
68 |
end = []
|
69 |
for etk in stop_tokens:
|
|
|
91 |
max_tokens = st.slider('max tokens', 4, 512, default_tokens)
|
92 |
|
93 |
if st.checkbox("使用换行符作为截断", value=True):
|
94 |
+
stop_tokens = "\n"
|
95 |
|
96 |
def completion():
|
97 |
resp = requests.post("https://welm.weixin.qq.com/v1/completions", json={
|
|
|
101 |
'top_p': top_p,
|
102 |
'top_k': top_k,
|
103 |
'n': n,
|
104 |
+
'model': model,
|
105 |
+
"stop": stop_tokens,
|
106 |
}, headers={"Authorization": f"Bearer {st.secrets['token']}"})
|
107 |
answer = resp.json()
|
108 |
for idx, choice in enumerate(answer['choices']):
|