1from inference import LegionVideoGenerator
23generator = LegionVideoGenerator()4video_path = generator.generate_from_text(5 prompt="A serene mountain lake at sunset with colorful clouds reflecting on the water, gentle ripples, cinematic quality",6 num_frames=49,7 width=480,8 height=480,9 num_inference_steps=50,10 guidance_scale=6.0,11 watermark_strength=0.3,12)13print(f"Video saved to: {video_path}")
Starting the Web UI
bash
1# Start the API backend2python3 backend/main.py &34# Start the Gradio frontend5python3 frontend/app.py
67# Open http://localhost:8080 in your browser
🌐 API Documentation
REST API Endpoints
The backend runs on port 8081 by default.
Method
Endpoint
Description
GET
/api/status
Health check with model and device info
POST
/api/generate/text
Generate video from text prompt
POST
/api/generate/image
Generate video from image + text prompt
GET
/
API root with endpoint listing
Text-to-Video Generation
python
1import requests
23response = requests.post(4"http://localhost:8081/api/generate/text",5 json={6"prompt":"A cyberpunk city street at night with neon lights reflecting on wet pavement",7"negative_prompt":"warped, distorted, flickering, jittery, low quality, blurry, artifacts",8"num_frames":49,9"width":480,10"height":480,11"num_inference_steps":50,12"guidance_scale":6.0,13"watermark_strength":0.3,14}15)1617withopen("output.mp4","wb")as f:18 f.write(response.content)