Initial commit: Revids REST API for LTX-2.3 image-to-video generation

- FastAPI with job polling: POST /generate, GET /jobs/{id}, /download, /health
- SQLite job persistence (aiosqlite), background task processing
- LTX-2.3 DistilledPipeline via native ltx-pipelines (editable install from submodule)
- Configurable model paths, LoRA support, FP8 quantization via env vars
- Single-concurrency GPU lock for safe inference
- LTX-2 as git submodule under libs/
This commit is contained in:
2026-05-31 05:54:51 -04:00
commit 2d50679ec0
12 changed files with 708 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
from __future__ import annotations
import uuid
from typing import Optional
from pydantic import BaseModel, Field
# --- Request ---
class GenerateRequest(BaseModel):
prompt: Optional[str] = Field(None, description="Optional text prompt to guide generation")
width: int = Field(768, ge=256, le=2048, multiple_of=32, description="Video width (must be divisible by 32)")
height: int = Field(512, ge=256, le=2048, multiple_of=32, description="Video height (must be divisible by 32)")
num_frames: int = Field(65, ge=9, le=257, description="Frame count (must be 8n+1)")
fps: float = Field(24.0, gt=0, le=60, description="Frames per second")
seed: Optional[int] = Field(None, description="Random seed for reproducibility")
# --- Job Status ---
class JobStatusResponse(BaseModel):
job_id: str
status: str # pending, processing, completed, failed
prompt: Optional[str] = None
params: Optional[dict] = None
error: Optional[str] = None
created_at: Optional[str] = None
completed_at: Optional[str] = None
# --- Submission Response ---
class JobSubmitResponse(BaseModel):
job_id: str
status: str = "pending"
message: str = "Job submitted. Poll GET /jobs/{job_id} for status."
# --- Error ---
class ErrorResponse(BaseModel):
error: str