yuripeyamashita
commited on
Commit
•
1caf542
1
Parent(s):
7b910fd
Update app.py
Browse files
app.py
CHANGED
@@ -32,9 +32,22 @@ def asr():
|
|
32 |
|
33 |
res = requests.post(URL, json=body, headers=headers)
|
34 |
if res.status_code == 200:
|
|
|
|
|
35 |
callbackURL = data.get('callbackURL')
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
return {'error': '請求失敗'}, 500
|
40 |
|
|
|
32 |
|
33 |
res = requests.post(URL, json=body, headers=headers)
|
34 |
if res.status_code == 200:
|
35 |
+
res_json = res.json()
|
36 |
+
|
37 |
callbackURL = data.get('callbackURL')
|
38 |
+
callback_body = data.get('callbackBody')
|
39 |
+
|
40 |
+
if res_json.get('data'):
|
41 |
+
callback_body['length'] = len(res_json.data[0])
|
42 |
+
if res_json.get('srt'):
|
43 |
+
callback_body['srt'] = res_json.srt[0]
|
44 |
+
|
45 |
+
requests.post(callbackURL, json=callback_body)
|
46 |
+
|
47 |
+
print(callback_body)
|
48 |
+
print(res_json)
|
49 |
+
|
50 |
+
return res_json
|
51 |
|
52 |
return {'error': '請求失敗'}, 500
|
53 |
|