A powerful, comprehensive multimodal AI system that provides state-of-the-art capabilities for text-to-image, text-to-video, image-to-video generation, and advanced enhancement features. Built with cutting-edge models and optimized for production use.
git clone <repository-url>
cd veo5
pip install -r requirements.txt
docker build -t multimodal-ai .
docker run --gpus all -p 8000:8000 multimodal-ai
# Run full demonstration
python main.py --demo
# Create training datasets
python main.py --create-datasets
# Start API server
python main.py --api
# Setup directories only
python main.py --setup
from core.multimodal_ai import MultimodalAI
# Initialize system
ai = MultimodalAI(device="cuda")
# Generate image
result = ai.text_to_image(
prompt="a majestic dragon flying over a cyberpunk city",
model="sdxl",
width=1024,
height=1024,
enhance=True
)
# Generate video
result = ai.text_to_video(
prompt="waves crashing on a rocky shore at sunset",
model="zeroscope",
num_frames=24,
fps=8
)
# Image to video
result = ai.image_to_video(
image="path/to/image.jpg",
model="stable_video",
num_frames=25
)
# Enhance image
result = ai.enhance_image(
image="path/to/image.jpg",
model="realesrgan",
scale=4,
face_enhance=True
)
# Start server
python main.py --api
# Generate image
curl -X POST "http://localhost:8000/generate/text-to-image" \
-H "Content-Type: application/json" \
-d '{
"prompt": "a beautiful landscape",
"model": "sdxl",
"width": 1024,
"height": 1024
}'
# Check task status
curl "http://localhost:8000/task/{task_id}"
| Model | Resolution | Speed | Quality | Memory |
|---|---|---|---|---|
| SDXL | 1024x1024 | ~30s | βββββ | 6GB |
| SD3 | 1024x1024 | ~25s | βββββ | 8GB |
| Flux | 1024x1024 | ~40s | βββββ | 12GB |
| Model | Resolution | Frames | Speed | Quality |
|---|---|---|---|---|
| ZeroScope | 576x320 | 24 | ~2min | ββββ |
| ModelScope | 256x256 | 16 | ~1min | βββ |
| CogVideoX | 720x480 | 48 | ~5min | βββββ |
# config.py
@dataclass
class ModelConfig:
device: str = "cuda"
mixed_precision: bool = True
compile_models: bool = True
enable_xformers: bool = True
max_batch_size: int = 4
# ... more options
# Enable memory optimizations
config.enable_cpu_offload = True
config.enable_attention_slicing = True
config.enable_vae_slicing = True
# Multi-step workflow
workflow = [
{
"type": "text_to_image",
"args": {"prompt": "a portrait", "model": "sdxl"}
},
{
"type": "enhance_image",
"args": {"model": "gfpgan", "scale": 4},
"input_from": 0
},
{
"type": "image_to_video",
"args": {"model": "stable_video", "num_frames": 25},
"input_from": 1
}
]
result = ai.create_workflow(workflow)
# Process multiple tasks in parallel
tasks = [
{"type": "text_to_image", "args": {"prompt": "landscape 1"}},
{"type": "text_to_image", "args": {"prompt": "landscape 2"}},
{"type": "text_to_video", "args": {"prompt": "ocean waves"}}
]
results = ai.batch_process(tasks, max_concurrent=2)
# Use ControlNet for precise control
result = ai.text_to_image(
prompt="a futuristic building",
control_image=edge_image,
control_type="canny",
controlnet_conditioning_scale=1.0
)
from datasets.dataset_generator import MultimodalDatasetGenerator
generator = MultimodalDatasetGenerator()
# Generate text-image pairs
samples = generator.generate_text_image_pairs(num_samples=10000)
# Generate text-video pairs
video_samples = generator.generate_text_video_pairs(num_samples=5000)
# Create training splits
generator.create_training_splits(dataset_path)
POST /generate/text-to-image - Generate images from textPOST /generate/text-to-video - Generate videos from textPOST /generate/image-to-video - Generate videos from imagesPOST /enhance/image - Enhance image qualityPOST /enhance/video - Enhance video qualityPOST /workflow - Execute multi-step workflowsPOST /batch - Process multiple tasksGET /task/{task_id} - Get task statusGET /models - List available modelsGET /stats - System statistics# API key authentication (if enabled)
curl -H "X-API-Key: your-api-key" \
"http://localhost:8000/generate/text-to-image"
# Get system statistics
stats = ai.get_stats()
print(f"Total generations: {stats['total_generations']}")
print(f"Average time: {stats['average_time']:.2f}s")
print(f"Memory usage: {stats['memory']}")
import logging
logging.basicConfig(level=logging.INFO)
# Logs include:
# - Generation times
# - Memory usage
# - Model loading/unloading
# - Error tracking
version: '3.8'
services:
multimodal-ai:
build: .
ports:
- "8000:8000"
environment:
- CUDA_VISIBLE_DEVICES=0
volumes:
- ./models:/app/models
- ./outputs:/app/outputs
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
apiVersion: apps/v1
kind: Deployment
metadata:
name: multimodal-ai
spec:
replicas: 2
selector:
matchLabels:
app: multimodal-ai
template:
spec:
containers:
- name: multimodal-ai
image: multimodal-ai:latest
resources:
limits:
nvidia.com/gpu: 1
memory: 32Gi
requests:
memory: 16Gi
upstream multimodal_ai {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
}
server {
listen 80;
location / {
proxy_pass http://multimodal_ai;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
# Reduce batch size
config.max_batch_size = 1
# Enable CPU offloading
config.enable_cpu_offload = True
# Use smaller models
ai.text_to_image(model="sd15", width=512, height=512)
# Enable model compilation
config.compile_models = True
# Use mixed precision
config.mixed_precision = True
# Enable XFormers
config.enable_xformers = True
# Clear cache
rm -rf ~/.cache/huggingface/
# Reinstall dependencies
pip install --upgrade diffusers transformers
# Check disk space
df -h
torch.compilegit clone <repository-url>
cd veo5
pip install -e .
pip install -r requirements-dev.txt
pre-commit install
# Format code
black .
isort .
# Lint code
flake8 .
mypy .
# Run tests
pytest tests/
BaseMultimodalModelload_model, unload_model, generateconfig.pyMultimodalAIThis project is licensed under the MIT License - see the LICENSE file for details.
Built with β€οΈ for the AI community
2 commits
Python
100.0%
A powerful, comprehensive multimodal AI system that provides state-of-the-art capabilities for text-to-image, text-to-video, image-to-video generation, and advanced enhancement features. Built with cutting-edge models and optimized for production use.
git clone <repository-url>
cd veo5
pip install -r requirements.txt
docker build -t multimodal-ai .
docker run --gpus all -p 8000:8000 multimodal-ai
# Run full demonstration
python main.py --demo
# Create training datasets
python main.py --create-datasets
# Start API server
python main.py --api
# Setup directories only
python main.py --setup
from core.multimodal_ai import MultimodalAI
# Initialize system
ai = MultimodalAI(device="cuda")
# Generate image
result = ai.text_to_image(
prompt="a majestic dragon flying over a cyberpunk city",
model="sdxl",
width=1024,
height=1024,
enhance=True
)
# Generate video
result = ai.text_to_video(
prompt="waves crashing on a rocky shore at sunset",
model="zeroscope",
num_frames=24,
fps=8
)
# Image to video
result = ai.image_to_video(
image="path/to/image.jpg",
model="stable_video",
num_frames=25
)
# Enhance image
result = ai.enhance_image(
image="path/to/image.jpg",
model="realesrgan",
scale=4,
face_enhance=True
)
# Start server
python main.py --api
# Generate image
curl -X POST "http://localhost:8000/generate/text-to-image" \
-H "Content-Type: application/json" \
-d '{
"prompt": "a beautiful landscape",
"model": "sdxl",
"width": 1024,
"height": 1024
}'
# Check task status
curl "http://localhost:8000/task/{task_id}"
| Model | Resolution | Speed | Quality | Memory |
|---|---|---|---|---|
| SDXL | 1024x1024 | ~30s | βββββ | 6GB |
| SD3 | 1024x1024 | ~25s | βββββ | 8GB |
| Flux | 1024x1024 | ~40s | βββββ | 12GB |
| Model | Resolution | Frames | Speed | Quality |
|---|---|---|---|---|
| ZeroScope | 576x320 | 24 | ~2min | ββββ |
| ModelScope | 256x256 | 16 | ~1min | βββ |
| CogVideoX | 720x480 | 48 | ~5min | βββββ |
# config.py
@dataclass
class ModelConfig:
device: str = "cuda"
mixed_precision: bool = True
compile_models: bool = True
enable_xformers: bool = True
max_batch_size: int = 4
# ... more options
# Enable memory optimizations
config.enable_cpu_offload = True
config.enable_attention_slicing = True
config.enable_vae_slicing = True
# Multi-step workflow
workflow = [
{
"type": "text_to_image",
"args": {"prompt": "a portrait", "model": "sdxl"}
},
{
"type": "enhance_image",
"args": {"model": "gfpgan", "scale": 4},
"input_from": 0
},
{
"type": "image_to_video",
"args": {"model": "stable_video", "num_frames": 25},
"input_from": 1
}
]
result = ai.create_workflow(workflow)
# Process multiple tasks in parallel
tasks = [
{"type": "text_to_image", "args": {"prompt": "landscape 1"}},
{"type": "text_to_image", "args": {"prompt": "landscape 2"}},
{"type": "text_to_video", "args": {"prompt": "ocean waves"}}
]
results = ai.batch_process(tasks, max_concurrent=2)
# Use ControlNet for precise control
result = ai.text_to_image(
prompt="a futuristic building",
control_image=edge_image,
control_type="canny",
controlnet_conditioning_scale=1.0
)
from datasets.dataset_generator import MultimodalDatasetGenerator
generator = MultimodalDatasetGenerator()
# Generate text-image pairs
samples = generator.generate_text_image_pairs(num_samples=10000)
# Generate text-video pairs
video_samples = generator.generate_text_video_pairs(num_samples=5000)
# Create training splits
generator.create_training_splits(dataset_path)
POST /generate/text-to-image - Generate images from textPOST /generate/text-to-video - Generate videos from textPOST /generate/image-to-video - Generate videos from imagesPOST /enhance/image - Enhance image qualityPOST /enhance/video - Enhance video qualityPOST /workflow - Execute multi-step workflowsPOST /batch - Process multiple tasksGET /task/{task_id} - Get task statusGET /models - List available modelsGET /stats - System statistics# API key authentication (if enabled)
curl -H "X-API-Key: your-api-key" \
"http://localhost:8000/generate/text-to-image"
# Get system statistics
stats = ai.get_stats()
print(f"Total generations: {stats['total_generations']}")
print(f"Average time: {stats['average_time']:.2f}s")
print(f"Memory usage: {stats['memory']}")
import logging
logging.basicConfig(level=logging.INFO)
# Logs include:
# - Generation times
# - Memory usage
# - Model loading/unloading
# - Error tracking
version: '3.8'
services:
multimodal-ai:
build: .
ports:
- "8000:8000"
environment:
- CUDA_VISIBLE_DEVICES=0
volumes:
- ./models:/app/models
- ./outputs:/app/outputs
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
apiVersion: apps/v1
kind: Deployment
metadata:
name: multimodal-ai
spec:
replicas: 2
selector:
matchLabels:
app: multimodal-ai
template:
spec:
containers:
- name: multimodal-ai
image: multimodal-ai:latest
resources:
limits:
nvidia.com/gpu: 1
memory: 32Gi
requests:
memory: 16Gi
upstream multimodal_ai {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
}
server {
listen 80;
location / {
proxy_pass http://multimodal_ai;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
# Reduce batch size
config.max_batch_size = 1
# Enable CPU offloading
config.enable_cpu_offload = True
# Use smaller models
ai.text_to_image(model="sd15", width=512, height=512)
# Enable model compilation
config.compile_models = True
# Use mixed precision
config.mixed_precision = True
# Enable XFormers
config.enable_xformers = True
# Clear cache
rm -rf ~/.cache/huggingface/
# Reinstall dependencies
pip install --upgrade diffusers transformers
# Check disk space
df -h
torch.compilegit clone <repository-url>
cd veo5
pip install -e .
pip install -r requirements-dev.txt
pre-commit install
# Format code
black .
isort .
# Lint code
flake8 .
mypy .
# Run tests
pytest tests/
BaseMultimodalModelload_model, unload_model, generateconfig.pyMultimodalAIThis project is licensed under the MIT License - see the LICENSE file for details.
Built with β€οΈ for the AI community
2 commits
Python
100.0%