A full-stack AI-powered application that generates videos and images from text prompts. Built with React frontend, Express.js backend, and integrated with Hugging Face AI models and local Stable Diffusion.
- AI Video Generation: Create videos from text descriptions using Hugging Face models
- AI Image Generation: Generate high-quality images using local Stable Diffusion v1.4
- Modern Web Interface: Beautiful, responsive React frontend with dark/light mode
- Real-time Processing: Live progress indicators and status updates
- Download Support: Direct download of generated content
- Error Handling: Comprehensive error handling with user-friendly messages
- Cross-platform: Works on Windows, macOS, and Linux
text-video/
βββ frontend/ # React frontend application
β βββ src/ # Source code
β βββ public/ # Static assets
β βββ package.json # Frontend dependencies
βββ backend-express/ # Express.js backend API
β βββ index.js # Main server file
β βββ generate_image.py # Python image generation script
β βββ models/ # Local AI models
β βββ package.json # Backend dependencies
βββ venv/ # Python virtual environment
βββ LICENSE # MIT License
- Node.js (v18.0.0 or higher)
- npm (v8.0.0 or higher)
- Python (v3.8 or higher)
- CUDA-compatible GPU (optional, for faster image generation)
- Hugging Face Account (for video generation API access)
git clone <repository-url>
cd text-videocd backend-express
npm install# Navigate to project root
cd ..
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate
# Install Python dependencies
pip install -r backend-express/requirements.txt
# Install PyTorch with CUDA support (recommended)
pip install torch==2.1.0+cu121 torchvision==0.16.0+cu121 --index-url https://download.pytorch.org/whl/cu121# Create .env file in backend-express directory
cd backend-express
echo "HF_TOKEN=your_hugging_face_token_here" > .envcd frontend
npm installcd backend-express
npm run devThe backend will start on http://localhost:3001
cd frontend
npm startThe frontend will start on http://localhost:3000
Open your browser and navigate to http://localhost:3000
- Select "Video" mode in the interface
- Enter a detailed text prompt describing the video you want
- Click "Generate AI Video"
- Wait for the generation to complete
- Preview and download your video
- Select "Image" mode in the interface
- Enter a detailed text prompt describing the image you want
- Click "Generate AI Image"
- Wait for the generation to complete
- Preview and download your image
- "A cat playing in a garden with butterflies flying around"
- "A futuristic city with flying cars and neon lights"
- "Ocean waves crashing against rocky cliffs at sunset"
- "A serene mountain landscape at golden hour"
- "A cyberpunk street scene with neon signs"
- "A cozy cabin in a snowy forest"
| Variable | Description | Required | Default |
|---|---|---|---|
HF_TOKEN |
Hugging Face API token | Yes | - |
PORT |
Server port | No | 3001 |
- Video Generation:
ali-vilab/text-to-video-ms-1.7b - Image Generation: Local Stable Diffusion v1.4
# Create .env file in frontend directory
REACT_APP_API_URL=http://localhost:3001
REACT_APP_APP_NAME=VideoCreatorGET /healthPOST /api/generate-ai-video
Content-Type: application/json
{
"prompt": "Your video description"
}POST /api/generate-ai-image
Content-Type: application/json
{
"prompt": "Your image description"
}For detailed API documentation, see Backend README.
- API Token Security: Hugging Face tokens stored in environment variables
- Input Validation: All prompts validated before processing
- CORS Configuration: Properly configured for frontend integration
- Error Handling: Sensitive information not exposed in error messages
cd frontend
npm run buildcd backend-express
npm starttext-video/
βββ frontend/ # React frontend
β βββ src/
β β βββ App.js # Main application component
β β βββ App.css # Application styles
β β βββ index.js # Application entry point
β βββ public/ # Static assets
β βββ package.json # Frontend dependencies
βββ backend-express/ # Express.js backend
β βββ index.js # Main server file
β βββ generate_image.py # Python image generation
β βββ models/ # Local AI models
β β βββ stable-diffusion-v1-4/
β βββ generated-images/ # Generated content storage
β βββ package.json # Backend dependencies
βββ venv/ # Python virtual environment
βββ LICENSE # MIT License
βββ README.md # This file
cd frontend
npm testcd backend-express
# Test API endpoints
curl http://localhost:3001/health
curl http://localhost:3001/api/test-hf-token- GPU Acceleration: Use CUDA for faster image generation
- Model Caching: Models are loaded once and reused
- Memory Management: Attention slicing for large models
- Bundle Optimization: Code splitting and lazy loading
- Follow existing code style
- Add tests for new features
- Update documentation
- Ensure cross-platform compatibility
- Test with both video and image generation
This project is licensed under the MIT License - see the LICENSE file for details.
- Hugging Face Models - AI models used
- Stable Diffusion - Image generation model
- React Documentation - Frontend framework
- Express.js Guide - Backend framework
- Hugging Face for providing AI models and API
- Stability AI for Stable Diffusion
- React Team for the amazing frontend framework
- Express.js Team for the robust backend framework
- Open Source Community for continuous improvements