Ensure the face has clear human features with eyes, nose, lips. Non-human faces will not work
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.jsimport fetch, { FormData, fileFrom } from'node-fetch';constpayload= {};asyncfunctiongooeyAPI() {constformData=newFormData()formData.set('json',JSON.stringify(payload))// add the path to your input faceformData.append('input_face',awaitfileFrom('lipsync-bulk/image.png'))// add the path to your input audioformData.append('input_audio',awaitfileFrom('lipsync-bulk/audio_2024-03-26_11-00-36.ogg.wav'))constresponse=awaitfetch("https://api.gooey.ai/v2/Lipsync/form/", { method:"POST", headers: {"Authorization":"Bearer "+process.env["GOOEY_API_KEY"], }, body: formData, });if (!response.ok) {thrownewError(response.status); }constresult=awaitresponse.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',awaitfileFrom('lipsync-bulk/image.png'))formData.append('input_audio',awaitfileFrom('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.pyimport osimport requestsimport jsonfiles = [ ("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.contentresult = 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:
$nodeindex.js
If you did everything correctly should get a response like this: