Created
February 1, 2024 05:13
-
-
Save tiny-rawr/4a51fc1a1180eb03b6e8e6bd4e8a7272 to your computer and use it in GitHub Desktop.
Generate talking avatar video from image and audio file with GooeyAI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
def generate_talking_avatar(image_filepath, audio_filepath): | |
api_key = "<YOUR_API_KEY>" | |
files = [ | |
("input_face", open(image_filepath, "rb")), | |
("input_audio", open(audio_filepath, "rb")), | |
] | |
payload = {} | |
try: | |
response = requests.post( | |
"https://api.gooey.ai/v2/Lipsync/form/", | |
headers={"Authorization": "Bearer " + api_key}, | |
files=files, | |
data={"json": json.dumps(payload)}, | |
) | |
response.raise_for_status() | |
result = response.json() | |
return result['output']['output_video'] | |
# Usage example | |
generate_talking_avatar(image_file, audio_file) | |
# => Produces a URL to the video of your talking avatar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment