LogoLogo
HomeExploreDocsAPIBlogContact
  • 🗃️Gooey.AI Docs
  • Changelog
  • 📖Guides
    • 🤖How to build an AI Copilot?
      • AI Prompting: Best practices
      • Curate your Knowledge Base Documents
      • Advanced Settings
      • Prepare Synthetic Data
      • Conversation Analysis
        • Glossary
      • Building a Multi-Modal Copilot
      • Frequently Asked Questions about AI Copilot
      • How to Automate Data Export?
    • 🚀How to deploy an AI Copilot?
      • Deploy to Web
      • Deploy to WhatsApp
      • Deploy to Slack
      • Deploy to Facebook
      • Broadcast Messages (via web or API)
      • Add buttons to your Copilot
    • ⚖️Understanding Bulk Runner and Evaluation
      • 💪How to set up Bulk Runner?
      • 🕵️‍♀️How to set up Evaluations?
      • How to use Bulk Run via API
    • 👄How to use AI Lip Sync Generator?
      • Lip Sync Animation Generator (WITH AUDIO FILES)
      • LipSync videos with Custom Voices
      • Set up your API for Lipsync with Local Folders
      • Tips to create great HD lipsync output
      • Frequently Asked Questions about Lipsync
    • 🗣️How to use ASR?
      • 📊How to create language evaluation for ASR?
    • How to use Compare AI Translations?
      • Google Translate Glossary
    • How does RAG-based document search work?
    • 🧩How to use Gooey Functions?
      • ✨LLM-enabled Functions
      • How to use SECRETS in Functions?
      • 🔥How to connect FirebaseDB to Copilot
    • 🎞️How to create AI Animations?
    • 🤳How to make amazing AI Art QR Codes?
      • API tips on AI Art QR Codes
    • 🖼️Create an AI Image with text
      • AI Image Prompting
      • API Tips for AI Image Generator
    • 📸AI Photo Editor
      • Build your avatar with AI
    • 🧑‍🏫How to use Gooey.AI’s Image Model Trainer?
    • 🔍Generate “People Also Ask” SEO Content
    • 🌐How to create SEO-Optimized content with AI?
    • How to use Workspaces?
      • How to use Version History?
      • How to add SECRETS in your Workspace?
    • 🍟How can I get free credits?
  • 😇CONTRIBUTING
    • Contributing
    • Documentation Style Guide
  • 🤓API REFERENCE
    • Getting started
    • API Generator
    • Rate Limits
    • Error Codes
  • 🍭ENDPOINTS
    • Copilot
    • Lipsync
    • Lipsync TTS
    • AI Art QR Generator
    • AI Animation Generator
    • Compare AI Image Generator
    • Gooey.AI on GitHub
Powered by GitBook
LogoLogo

Home

  • Gooey.AI
  • Explore Workflows
  • Sign In
  • Pricing

Learn

  • Docs
  • Blog
  • FAQs
  • Videos

Developers

  • How-to Guides
  • Get your Gooey.AI Key
  • Github
  • API Endpoints

Connect

  • Book a Demo
  • Discord
  • Team
  • Jobs

@Dara.network / Gooey.AI / support@gooey.ai

On this page
  • Step 1 - Start a new Node.js project with npm init
  • Step 2 - Setup up your local folders with input files
  • Step 3 - Create your app file
  • Step 4 - Run your app

Was this helpful?

Edit on GitHub
  1. Guides
  2. How to use AI Lip Sync Generator?

Set up your API for Lipsync with Local Folders

Here is a quickstart guide to setting up your API with local folders. Go through the tabs for node.js or python!

Last updated 1 year ago

Was this helpful?

Step 1 - Start a new Node.js project with npm init

Install node-fetch and add your API key

  1. Start a new node.js project

  2. Install node-fetch and add your API key

$ npm init -y
$ npm install node-fetch
$ export GOOEY_API_KEY=sk-xxxx 

Install requests & add the GOOEY_API_KEY to your environment variables.

$ python3 -m pip install requests
$ export GOOEY_API_KEY=sk-xxxx

Step 2 - Setup up your local folders with input files

To use you need two types of input files for the project:

  1. Input face

    • This is refered to as input_face in the API

    • Use the following formats - mp4 / mov / png / jpg

    • Ensure the face has clear human features with eyes, nose, lips. Non-human faces will not work

  2. Input audio

    • This is referred to as input_audio

    • Use the following formats only - wav / mp3

For ease of use make sure the folders are all located in the same project. In this example, we have added the input_face and input_audio in the folder lipsync-bulk.

Step 3 - Create your app file

Create your index.js file

Copy the example code below to test your API call.

// save this in index.js

import fetch, { FormData, fileFrom } from 'node-fetch';

const payload = {};

async function gooeyAPI() {
  const formData = new FormData()
  formData.set('json', JSON.stringify(payload))
  // add the path to your input face
  formData.append('input_face', await fileFrom('lipsync-bulk/image.png'))
  // add the path to your input audio
  formData.append('input_audio', await fileFrom('lipsync-bulk/audio_2024-03-26_11-00-36.ogg.wav'))

  const response = await fetch("https://api.gooey.ai/v2/Lipsync/form/", {
    method: "POST",
    headers: {
      "Authorization": "Bearer " + process.env["GOOEY_API_KEY"],
    },
    body: formData,
  });

  if (!response.ok) {
    throw new Error(response.status);
  }

  const result = await response.json();
  console.log(response.status, result);
}

gooeyAPI();

Replace with your file paths

In the code above, replace the file paths as per the location of your local file location.

//this is the code snippet that needs to be replaced 

formData.append('input_face', await fileFrom('lipsync-bulk/image.png'))
formData.append('input_audio', await fileFrom('lipsync-bulk/audio_2024-03-26_11-00-36.ogg.wav'))

Create your main.py file

Copy the example code below to test your API call.

// save this in main.py

import os
import requests
import json

files = [
    ("input_face", open("lipsync-bulk/image.png", "rb")),
    ("input_audio", open("lipsync-bulk/audio_2024-03-26_11-00-36.ogg.wav", "rb")),
]
payload = {}

response = requests.post(
    "https://api.gooey.ai/v2/Lipsync/form/?run_id=fecsii61rs6e&uid=fm165fOmucZlpa5YHupPBdcvDR02",
    headers={
        "Authorization": "Bearer " + os.environ["GOOEY_API_KEY"],
    },
    files=files,
    data={"json": json.dumps(payload)},
)
assert response.ok, response.content

result = response.json()
print(response.status_code, result)

Replace with your file paths

In the code above, replace the file paths as per the location of your local file location.

//this is the code snippet that needs to be replaced 

files = [
    ("input_face", open("lipsync-bulk/image.png", "rb")),
    ("input_audio", open("lipsync-bulk/audio_2024-03-26_11-00-36.ogg.wav", "rb")),
]

Step 4 - Run your app

Test if your app is working correctly

Run:

$ node index.js 

If you did everything correctly should get a response like this:

200 {
  id: 'm0rghxk55xfx',
  url: 'https://gooey.ai/Lipsync/?run_id=m0rghxk55xfx&uid=fm165fOmucZlpa5YHupPBdcvDR02',
  created_at: '2024-03-26T06:01:57.449762',
  output: {
    output_video: 'https://storage.googleapis.com/dara-c1b52.appspot.com/daras_ai/media/5abbbb76-eb36-11ee-8c54-02420a00014c/gooey.ai%20lipsync.mp4'
  }
}

Run:

$ python main.py

If you did everything correctly should get a response like this:

200 {'id': 'enqn22dnppiy', 'url': 'https://gooey.ai/Lipsync/?run_id=enqn22dnppiy&uid=fm165fOmucZlpa5YHupPBdcvDR02', 'created_at': '2024-03-26T06:39:44.768886', 'output': {'output_video': 'https://storage.googleapis.com/dara-c1b52.appspot.com/daras_ai/media/a227237e-eb3b-11ee-a294-02420a000146/gooey.ai%20lipsync.mp4'}}
📖
👄
GOOEY.AI lipsync tool