This project was awarded the Honourable Mention in the Livepeer AI x SwarmZero Video Hackathon 2024
This project leverages SwarmZero AI and Livepeer AI to create an AI-driven news video generator. The system starts with a News Aggregator Agent that fetches real-time news from external APIs. The Audio Narration Agent converts news descriptions into speech, and a series of agents—Scene Prompt Generator, Image Generator, and Image-to-Video Generator—create engaging visuals. These images and narration are combined into short video segments through the Video Editor Agent. Finally, the video is uploaded to YouTube via the YouTube Upload Agent. The project automates content creation, using AI and decentralized media pipelines, allowing for seamless generation of news videos and offering a unique tool for creators.
The SwarmZero AI allows user to use their preferred LLM model from OpenAI (gpt4, gpt4o, etc), Anthropic (3.5 sonnet, etc) or other open source LLMs by simply defining the model name in the configuration.
- Python 3.11
- OpenAI Key or open-source LLM
- Livepeer AI Key
- Google API Client
- TheNewsAPI Key
To set up YouTube API credentials, go to the Google API Console, create a new project, enable the YouTube Data API v3, and set up OAuth 2.0 credentials by configuring a consent screen and adding valid redirect URIs (http://localhost:8088/) and (http://localhost:8088/flowName=GeneralOAuthFlow) for authentication.
Download the client_secret.json file and place it in your project’s root directory to handle secure OAuth 2.0 authentication, which is necessary for authorizing API requests and accessing private YouTube data securely. Also, register yourself as a test user in the OAuth Consent Screen.
- Clone the repository
- Go to video-news-ai folder
cd video-news-ai
- Define environment variables for the backend:
touch .env
MODEL=gpt-4-turbo-preview
OPENAI_API_KEY=
MISTRAL_API_KEY=
ANTHROPIC_API_KEY=
ENVIRONMENT=dev
SWARMZERO_LOG_LEVEL=INFO
SWARMZERO_DATABASE_URL=
PINECONE_API_KEY=
LIVEPEER_API_KEY=
NEWS_API_KEY=
- Define environment variables for frontend:
touch ui/.env
NEXT_PUBLIC_BACKEND_API=http://127.0.0.1:8000/chat/
- Start the application:
docker-compose up
The application is ready on: http://localhost:3000
-
Setup Python virtual environment:
python -m venv .venv
-
Activate virtual environment:
On Windows:
.venv\Scripts\activate
On Unix or MacOS:
source .venv/bin/activate
-
Install library dependencies:
pip install -r requirements.txt
-
Run the agent:
uvicorn main:app --reload
-
Open another terminal and go to the ui folder:
cd ui
-
Start the frontend app:
npm run dev
The application is ready on: http://localhost:3000
-
Input prompt:
Create a short video from the two latest news
you can also specify the category such as business, tech, sports, etc.
-
Click on 'Generate' button
-
Wait for few minutes for generating process
-
Open browser and access to your Youtube channel to check the new video
- Implement a cron job for scheduled video publishing.
- Expand distribution to TikTok and Twitter.
- Add advanced editing features and human-like TTS.
- Optimize the prompt to ensure the tool runs with stability.
SwarmZero.ai: a decentralized platform designed to empower AI researchers, machine learning engineers, and agent builders
Livepeer AI: a foundational infrastructure for limitless video computing, enabling AI processing and transcoding jobs to power the future of video