Skip to content

Instantly share code, notes, and snippets.

@tiny-rawr
Created February 1, 2024 05:13
Show Gist options
  • Save tiny-rawr/4a51fc1a1180eb03b6e8e6bd4e8a7272 to your computer and use it in GitHub Desktop.
Save tiny-rawr/4a51fc1a1180eb03b6e8e6bd4e8a7272 to your computer and use it in GitHub Desktop.
Generate talking avatar video from image and audio file with GooeyAI
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