Skip to content

luquiluke/HeyGen-AI-Clone-Template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HeyGen AI Clone

Python Streamlit OpenAI HeyGen Tavily Make.com License

A single-file Streamlit app that turns today's top AI news into a published avatar video — fully automated, zero paid middleware.

Pipeline: Tavily news search → GPT-4o-mini script → HeyGen avatar video → Make.com social posting


What It Does

  1. Fetches the day's top AI news via Tavily
  2. Generates a 30-second script, social caption, and post title via GPT-4o-mini
  3. Submits the script to HeyGen to render an avatar video
  4. Polls HeyGen until the video is ready
  5. Posts the video to YouTube (and optionally Instagram/TikTok) via a Make.com webhook

Everything runs from one Streamlit page. Click Run Pipeline and the app handles the rest.


Demo

Pipeline screenshot


Prerequisites

Service Purpose Free tier
Tavily News search API Yes
OpenAI Script generation (GPT-4o-mini) Pay-as-you-go
HeyGen Avatar video generation Limited free credits
Make.com Social posting webhook 1,000 ops/month free

Setup

1. Clone and install

git clone https://github.com/luquiluke/HeyGen-AI-Clone-Template
cd HeyGen-AI-Clone-Template
python -m venv venv
source venv/Scripts/activate   # Windows/bash
# or: venv\Scripts\activate    # Windows/PowerShell
pip install -r requirements.txt

2. Configure environment

cp .env.example .env

Open .env and fill in your credentials:

# Required
TAVILY_API_KEY=your_key
OPENAI_API_KEY=your_key
HEYGEN_API_KEY=your_key
HEYGEN_AVATAR_ID=your_avatar_id
HEYGEN_VOICE_ID=your_voice_id       # for Text engine
# or
HEYGEN_ELEVENLABS_VOICE_ID=your_id  # for ElevenLabs engine

# Optional — override defaults
HEYGEN_VOICE_ENGINE=text            # text | elevenlabs
HEYGEN_AVATAR_STYLE=Normal          # Normal | Circle | Closeup
HEYGEN_VOICE_SPEED=1.0              # 0.5 – 1.5
HEYGEN_VOICE_PITCH=0                # -50 to 50
HEYGEN_ASPECT_RATIO=                # leave blank for 9:16 portrait
HEYGEN_POLL_INTERVAL=30             # seconds between status checks
HEYGEN_MAX_POLLS=20                 # give up after N polls

# Social posting (optional)
MAKE_WEBHOOK_URL=your_webhook_url

Every sidebar control reads from .env as its default — you can also change values directly in the sidebar at runtime.

3. Run

streamlit run app.py

Open http://localhost:8501.


Sidebar Controls

All HeyGen parameters are configurable without touching code:

Control Description
Avatar ID HeyGen avatar to use
Avatar Style Normal / Circle / Closeup presentation
Voice Engine Text (HeyGen native) or ElevenLabs
Voice ID UUID for the selected engine
Voice Speed 0.5× to 1.5×
Voice Pitch -50 to +50 semitones
Video Dimensions 9:16 Portrait, 16:9 Landscape, 1:1 Square
Poll Interval Seconds between HeyGen status checks
Max Polls Timeout threshold

Social Posting

Enable "Post to socials via Make.com" and paste your Make.com webhook URL. Check the platforms you want to post to (YouTube, Instagram, TikTok). The app sends one webhook call with the video URL, title, and caption — Make.com handles the actual posting asynchronously.

See MAKE_SETUP.md for step-by-step Make.com scenario setup.


Make.com Scenario

The app sends this payload to your webhook:

{
  "video_url": "https://...",
  "title": "AI News: ...",
  "caption": "That new model is a game-changer! #AINews",
  "platforms": ["youtube", "instagram", "tiktok"]
}

Your Make.com scenario should have:

  • Custom Webhook trigger
  • Router with one branch per platform (filter on platforms array)
  • YouTube: HTTP Get a file → YouTube Upload a Video
  • Instagram: Instagram for Business → Create a Reel Post
  • TikTok: HTTP module → TikTok Content Posting API

Note: TikTok posts are SELF_ONLY (private) until your developer app passes TikTok's audit process.


Project Structure

app.py                  # Single-file Streamlit pipeline (~500 lines)
requirements.txt        # Python dependencies
.env.example            # Environment variable reference
.env                    # Your credentials (gitignored)

Stack

  • Python 3.10+
  • Streamlit — UI and pipeline orchestration
  • OpenAI SDK — GPT-4o-mini script generation
  • Requests — HeyGen and Make.com API calls
  • python-dotenv.env loading

License

MIT

About

Streamlit app that turns today's AI news into an avatar video and posts it to YouTube — fully automated, zero paid middleware.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages