Spaces:
Build error
Build error
Trying to re-json the output
Browse files- utils/apis.py +4 -2
utils/apis.py
CHANGED
@@ -30,9 +30,11 @@ def call_gradio_api(api_name='test_api', data=()):
|
|
30 |
resp = requests.request("POST", gradio_url, headers=headers, data=payload)
|
31 |
print(f"Finished calling gradio API with result")
|
32 |
print(resp.text)
|
33 |
-
if api_name
|
34 |
return json.loads(resp.text)
|
35 |
-
|
|
|
|
|
36 |
if data:
|
37 |
video_path = data[0]
|
38 |
translated_video = anvil.media.from_file(video_path)
|
|
|
30 |
resp = requests.request("POST", gradio_url, headers=headers, data=payload)
|
31 |
print(f"Finished calling gradio API with result")
|
32 |
print(resp.text)
|
33 |
+
if api_name == 'caption':
|
34 |
return json.loads(resp.text)
|
35 |
+
if api_name == 'transcribe_translate':
|
36 |
+
return resp.json()['data']
|
37 |
+
data = resp.json()['data'][0]
|
38 |
if data:
|
39 |
video_path = data[0]
|
40 |
translated_video = anvil.media.from_file(video_path)
|