LivePortrait : Portrait Animation | Talking Ai Avatar for Free
People & Blogs
LivePortrait: Portrait Animation | Talking Ai Avatar for Free
Hi everyone!
In this article, we will explore how to run Live Portrait on Google Collab using resources from the Hugging Face space. The Live Portrait tool lets you animate images using reference videos, bringing static portraits to life.
Step 1: Setting Up Google Collab Notebook
To begin, we need to set up a Google Collab notebook. There are two configurations for this:
- Small Videos: This configuration is suited for small video durations.
- Large Videos: This setup handles larger videos efficiently.
Small Videos Configuration
Connect to GPU:
- Click on "Edit Notebook Settings" and set the hardware accelerator to GPU.
- Save the settings and proceed to "Runtime" -> "Run All".
Download Models:
- Use the Hugging Face model card to download pre-trained weights.
- Model sizes range from 115 MB to 222 MB, making them relatively small and quick to download.
Gradio Link:
- Once the notebook has run successfully, you will see a Gradio link.
- Click this link to open the Gradio app.
Using the Gradio App
Upload Image and Reference Video:
- Upload an image (e.g., Mona Lisa) and a reference video where a person is moving their eyes.
- If needed, use the cropping features, though it’s recommended not to alter advanced settings for better results.
Animate:
- Click ‘Animate’ and wait for 1-2 minutes while the AI generates the animated video.
- Download and play your animated video.
Large Videos Configuration
Connect to GPU:
- As before, set the hardware accelerator to GPU.
Mount Google Drive:
- Connect and mount your Google Drive.
Upload Reference Image and Video:
- Go to "My Drive" -> "Upload" folder.
- Upload your reference image and video.
Run the Code:
- Download pre-trained weights and install packages (this takes about 2-3 minutes).
- Click on "U" to start defining a few functions.
- Follow the instructions to enter the image and video IDs.
- Copy the path links provided and paste them where needed.
Process Video:
- The video is trimmed into 10-second clips.
- Each clip is passed to the AI model for inference.
- Clips are then merged together to form the final video.
Download Final Video:
- Automatically, the video will be saved to your Google Drive folder and downloaded to your local device.
By breaking the video into smaller chunks, this configuration ensures larger videos can be efficiently processed without crashing.
Keywords
- Google Collab
- Live Portrait
- Hugging Face
- Gradio App
- AI Animation
- Pre-trained Models
- GPU
- Video Processing
- Portrait Animation
FAQ
Q1: Can I use Live Portrait on longer videos?
A1: Yes, use the ‘Large Videos Configuration’ to handle longer video durations by trimming them into smaller 10-second clips.
Q2: What is the maximum video size Live Portrait can handle?
A2: The upper limit varies but for smoother operation, it's recommended to keep individual clips within a few MBs.
Q3: How can I ensure the entire face is animated?
A3: Make sure the uploaded image and reference video are both of 1:1 ratio (e.g., 512x512 or 256x256 pixels).
Q4: What to do if the GPU setup fails in Google Collab?
A4: Double-check that you've enabled GPU in "Edit Notebook Settings" and try restarting the runtime.
Q5: Where are my videos stored?
A5: Animated videos are saved in your mounted Google Drive folder under "Upload."
Q6: How long does it typically take to animate a video?
A6: Depending on the video size, it takes approximately 1-2 minutes for short videos and significantly longer for large ones.