Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -12,11 +12,12 @@ def predict(text, seed, out_seq_length, min_gen_length, sampling_strategy,
|
|
12 |
temperature, topk, topp):
|
13 |
global APIKEY
|
14 |
global APISECRET
|
|
|
15 |
url = 'https://wudao.aminer.cn/os/api/api/v2/completions_130B'
|
16 |
|
17 |
payload = json.dumps({
|
18 |
"apikey": APIKEY,
|
19 |
-
"apisecret": APISECRET,
|
20 |
"language": "zh-CN",
|
21 |
"prompt": text,
|
22 |
"length_penalty": length_penalty,
|
@@ -30,13 +31,12 @@ def predict(text, seed, out_seq_length, min_gen_length, sampling_strategy,
|
|
30 |
})
|
31 |
|
32 |
headers = {
|
33 |
-
|
34 |
}
|
35 |
|
36 |
response = requests.request("POST", url, headers=headers, data=payload)
|
37 |
|
38 |
-
|
39 |
-
return ret.text
|
40 |
|
41 |
|
42 |
if __name__ == "__main__":
|
|
|
12 |
temperature, topk, topp):
|
13 |
global APIKEY
|
14 |
global APISECRET
|
15 |
+
|
16 |
url = 'https://wudao.aminer.cn/os/api/api/v2/completions_130B'
|
17 |
|
18 |
payload = json.dumps({
|
19 |
"apikey": APIKEY,
|
20 |
+
"apisecret": APISECRET ,
|
21 |
"language": "zh-CN",
|
22 |
"prompt": text,
|
23 |
"length_penalty": length_penalty,
|
|
|
31 |
})
|
32 |
|
33 |
headers = {
|
34 |
+
'Content-Type': 'application/json'
|
35 |
}
|
36 |
|
37 |
response = requests.request("POST", url, headers=headers, data=payload)
|
38 |
|
39 |
+
return response.text
|
|
|
40 |
|
41 |
|
42 |
if __name__ == "__main__":
|