EC2 Default User commited on
Commit
e98544f
1 Parent(s): 91ebaf5

add get_a_talk func

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -204,6 +204,16 @@ def generate_talk_with_audio(input, avatar_url, api_key = did_api_key):
204
  response = requests.post(url, json=payload, headers=headers)
205
  return response.json()
206
 
 
 
 
 
 
 
 
 
 
 
207
  def get_mp4_video(input, avatar_url=avatar_url):
208
  response = generate_talk_with_audio(input=input, avatar_url=avatar_url)
209
  talk = get_a_talk(response['id'])
 
204
  response = requests.post(url, json=payload, headers=headers)
205
  return response.json()
206
 
207
+
208
+ def get_a_talk(id, api_key = os.environ.get('DID_API_KEY')):
209
+ url = "https://api.d-id.com/talks/" + id
210
+ headers = {
211
+ "accept": "application/json",
212
+ "authorization": "Basic "+api_key
213
+ }
214
+ response = requests.get(url, headers=headers)
215
+ return response.json()
216
+
217
  def get_mp4_video(input, avatar_url=avatar_url):
218
  response = generate_talk_with_audio(input=input, avatar_url=avatar_url)
219
  talk = get_a_talk(response['id'])