Spaces:
Sleeping
Sleeping
File size: 1,239 Bytes
6b4cdc0 96aaa55 6b4cdc0 b9a9571 6b4cdc0 45e6d3a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
import os, json
import requests
API_ENDPOINT = os.environ.get("API_ENDPOINT")
TOKEN = os.environ.get("TOKEN")
headers = {
'accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': f'Bearer {TOKEN}'
}
def get_health():
response = requests.get(API_ENDPOINT, headers=headers)
return response.json()
def handle_url(url, from_lang, to_lang, gender):
data = {
'url': url,
'from_lang': from_lang,
'to_lang': to_lang,
'gender': gender,
}
response = requests.post(f'{API_ENDPOINT}/synthesise_video_url', headers=headers, data=json.dumps(data))
return response.json()
def test_response():
response = {
"srt_url": "https://expressapi.s3.ap-south-1.amazonaws.com/2023-08-05/bfa44e1e97e24b6/subtitle.srt",
"video_url": "https://expressapi.s3.ap-south-1.amazonaws.com/2023-08-05/bfa44e1e97e24b6/translated_video.mp4",
"translated_srt_url": "https://expressapi.s3.ap-south-1.amazonaws.com/2023-08-05/bfa44e1e97e24b6/translated_subtitle.srt",
"translated_audio_url": "https://expressapi.s3.ap-south-1.amazonaws.com/2023-08-05/bfa44e1e97e24b6/translated_audio.mp3",
}
return response |