Skip to content

SoMika00/Ganimation2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎬 Ganimation Studio

AI-Powered Video Editing Platform - Transform your shorts into Ghibli-style animations

Python FastAPI Streamlit Docker License

✨ Features

  • πŸ“₯ Ingestion - Import videos via URL (YouTube Shorts, TikTok) or file upload
  • 🎨 Image Studio - Generate Ghibli-style frames with SDXL + ControlNet + LoRA
  • 🎬 Video Studio - Animate images with Wan2.2 + RIFE interpolation
  • πŸ–ΌοΈ Gallery - Organize source media, generated images, and videos
  • πŸ”Œ REST API - Full FastAPI backend for integration
  • 🐳 Docker Ready - Production-ready containerized deployment

πŸš€ Quick Start

Option 1: Docker (Recommended)

cd Ganimation2

# Start Studio (Streamlit) + ComfyUI
./run.sh

Access:

Persistent storage (host):

  • ./gallery/ (source videos + generated outputs)
  • ./temp/
  • ./models/ (non-ComfyUI models used by the app)
  • ./data/comfyui/models/ (ComfyUI models: checkpoints / loras / controlnet / etc.)
  • ./data/comfyui/custom_nodes/ (ComfyUI plugins)
  • ./data/comfyui/user/ (ComfyUI workflows + settings)

ComfyUI model placement (host):

  • LoRAs: ./data/comfyui/models/loras/
  • Checkpoints: ./data/comfyui/models/checkpoints/
  • ControlNet: ./data/comfyui/models/controlnet/

To move to another VM, copy ./data/comfyui/models, ./data/comfyui/custom_nodes, and ./data/comfyui/user.

Option 2: Local Development

# Create virtual environment
python -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Run the app
./run.sh local

Note: local mode does not start ComfyUI. If you run locally, start ComfyUI separately.

πŸ“ Project Structure

Ganimation2/
β”œβ”€β”€ app.py                    # Streamlit application
β”œβ”€β”€ config.py                 # Configuration management
β”œβ”€β”€ run.sh                    # Local run script
β”œβ”€β”€ docker-compose.yml        # API/worker stack (advanced)
β”œβ”€β”€ docker-compose.dev.yml    # API/worker stack (advanced)
β”œβ”€β”€ docker-compose.studio.yml # Minimal Studio + ComfyUI
β”‚
β”œβ”€β”€ api/                      # FastAPI Backend
β”‚   β”œβ”€β”€ main.py               # API entry point
β”‚   β”œβ”€β”€ config.py             # API configuration
β”‚   β”œβ”€β”€ routers/              # API endpoints
β”‚   β”‚   β”œβ”€β”€ ingestion.py      # Video import endpoints
β”‚   β”‚   β”œβ”€β”€ gallery.py        # Media management
β”‚   β”‚   β”œβ”€β”€ generation.py     # AI generation endpoints
β”‚   β”‚   └── system.py         # System & GPU info
β”‚   └── services/             # Business logic
β”‚       β”œβ”€β”€ video_service.py
β”‚       β”œβ”€β”€ gallery_service.py
β”‚       β”œβ”€β”€ generation_service.py
β”‚       └── gpu_manager.py
β”‚
β”œβ”€β”€ views/                    # Streamlit views/pages
β”‚   β”œβ”€β”€ ingestion.py          # Video import UI
β”‚   β”œβ”€β”€ gallery.py            # Media browser UI
β”‚   β”œβ”€β”€ image_studio.py       # Image generation UI
β”‚   └── video_studio.py       # Video generation UI
β”‚
β”œβ”€β”€ utils/                    # Shared utilities
β”‚   β”œβ”€β”€ video_processor.py    # FFmpeg operations
β”‚   β”œβ”€β”€ image_generator.py    # SDXL pipeline
β”‚   └── video_animator.py     # Wan2.2 pipeline
β”‚
β”œβ”€β”€ docker/                   # Docker configurations
β”‚   β”œβ”€β”€ Dockerfile.api        # API image
β”‚   β”œβ”€β”€ Dockerfile.frontend   # Frontend image
β”‚   β”œβ”€β”€ nginx.conf            # Reverse proxy config
β”‚   └── streamlit_config.toml
β”‚
β”œβ”€β”€ scripts/                  # Deployment scripts
β”‚   β”œβ”€β”€ docker-build.sh
β”‚   β”œβ”€β”€ docker-start.sh
β”‚   └── docker-stop.sh
β”‚
β”œβ”€β”€ .github/workflows/        # CI/CD
β”‚   └── ci.yml
β”‚
β”œβ”€β”€ data/                     # Data directories
β”‚   β”œβ”€β”€ gallery/
β”‚   β”‚   β”œβ”€β”€ source_media/     # Imported videos
β”‚   β”‚   β”œβ”€β”€ generated_images/ # Ghibli frames
β”‚   β”‚   └── generated_videos/ # Animated outputs
β”‚   β”œβ”€β”€ temp/                 # Temporary files
β”‚   └── models/               # AI models
β”‚
└── requirements*.txt         # Dependencies

🐳 Docker Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    NGINX (80/443)                           β”‚
β”‚                   Reverse Proxy                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚                   β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”
        β”‚    Frontend       β”‚ β”‚     API       β”‚
        β”‚  (Streamlit)      β”‚ β”‚  (FastAPI)    β”‚
        β”‚    :8501          β”‚ β”‚    :8000      β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                          β”‚           β”‚           β”‚
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”
                  β”‚  Worker   β”‚ β”‚   Redis   β”‚ β”‚ GPUs  β”‚
                  β”‚ (Tasks)   β”‚ β”‚  (Queue)  β”‚ β”‚2xH100 β”‚
                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”Œ API Endpoints

Ingestion

  • POST /api/v1/ingestion/download - Download video from URL
  • POST /api/v1/ingestion/upload - Upload video file
  • GET /api/v1/ingestion/videos - List all videos

Gallery

  • GET /api/v1/gallery/stats - Gallery statistics
  • GET /api/v1/gallery/source - List source media
  • GET /api/v1/gallery/images - List generated images
  • GET /api/v1/gallery/videos - List generated videos

Generation

  • POST /api/v1/generation/image - Generate Ghibli image
  • POST /api/v1/generation/video - Generate animated video
  • GET /api/v1/generation/tasks - List generation tasks
  • GET /api/v1/generation/tasks/{id} - Get task status

System

  • GET /api/v1/system/info - System information
  • GET /api/v1/system/gpu - GPU status
  • POST /api/v1/system/gpu/clear-cache - Clear GPU memory

🎨 Generation Pipelines

Image Generation (Ghibli Style)

Component Model Purpose
Base SDXL 1.0 High-quality generation
Style ntc-ai/SDXL-LoRA-slider.Studio-Ghibli-style Ghibli aesthetic
Structure ControlNet (Depth/Canny) Preserve source

Settings (H100 optimized):

  • Steps: 30
  • CFG: 5.0
  • LoRA Weight: 0.75
  • Batch Size: 4

Implementation note:

  • The ComfyUI workflow is generated dynamically in utils/comfyui_client.py and executed via the ComfyUI HTTP API.
  • That means you won't see a pre-saved graph in ComfyUI unless you build/import one yourself.

Video Generation

Generated Image + Source Video
            ↓
    Wan2.2 Animate Control
            ↓
    RIFE 4x Interpolation
            ↓
    Optional Upscale
            ↓
    Audio Merge + Encode
            ↓
        Output Video

πŸ–₯️ Hardware Optimization

2x NVIDIA H100 (160GB VRAM)

Automatic optimizations enabled:

  • βœ… TF32 Tensor Cores
  • βœ… BFloat16 precision
  • βœ… Flash Attention 2
  • βœ… torch.compile
  • βœ… Multi-GPU distribution
  • βœ… No memory offloading needed

πŸ“‹ Configuration

Environment Variables

# API
API_HOST=0.0.0.0
API_PORT=8000
API_WORKERS=2

# GPU
CUDA_VISIBLE_DEVICES=0,1
NVIDIA_TF32_OVERRIDE=1

# Generation
SDXL_STEPS=30
SDXL_BATCH_SIZE=4
WAN_NUM_FRAMES=96
RIFE_MULTIPLIER=4

See env.example for full configuration.

πŸ”§ Development

Local API Development

cd Ganimation2
source venv/bin/activate

# Run API with hot-reload
uvicorn api.main:app --reload --port 8000

# Run Frontend
streamlit run app.py

Docker Development

# Start with hot-reload
./scripts/docker-start.sh dev

# View logs
docker compose -f docker-compose.dev.yml logs -f

# Rebuild after changes
docker compose -f docker-compose.dev.yml up --build

🚒 Production Deployment

# Build images
./scripts/docker-build.sh

# Start production stack (with nginx)
./scripts/docker-start.sh prod -d

# Check status
docker compose ps
docker compose logs -f

πŸ“š Documentation

🀝 Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing)
  5. Open Pull Request

πŸ“„ License

MIT License - see LICENSE for details.

πŸ™ Acknowledgments

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors