Spaces:
Running on Zero
Running on Zero
Video preview at 480p, 20 steps, 240 s GPU budget
Browse files37 unmodified lines38394041424344454647484950515237 unmodified linesreturn path@spaces.GPU(duration=150)def video(prompt: str, start: str, seconds: float):seconds = max(2.0, min(5.0, float(seconds or 5)))img = Image.open(start).convert("RGB")# Wan 2.2 TI2V-5B renders 720p: 1280x704 or 704x1280.w, h = (704, 1280) if img.height >= img.width else (1280, 704)img = img.resize((w, h))frames = 4 * math.ceil(seconds * FPS / 4) + 1 # 4k+1 framesout = video_pipe(image=img, prompt=prompt, height=h, width=w, num_frames=frames, num_inference_steps=30, guidance_scale=5.0).frames[0]path = tempfile.NamedTemporaryFile(suffix=".mp4", delete=False).nameexport_to_video(out, path, fps=FPS)return path37 unmodified lines3839404142434445464748495051525337 unmodified linesreturn path@spaces.GPU(duration=240)def video(prompt: str, start: str, seconds: float):seconds = max(2.0, min(5.0, float(seconds or 5)))img = Image.open(start).convert("RGB")# Preview quality: 480p (Wan 2.2 TI2V-5B renders 720p natively, which is# too slow for a ZeroGPU call). Sizes are multiples of 32.w, h = (480, 832) if img.height >= img.width else (832, 480)img = img.resize((w, h))frames = 4 * math.ceil(seconds * FPS / 4) + 1 # 4k+1 framesout = video_pipe(image=img, prompt=prompt, height=h, width=w, num_frames=frames, num_inference_steps=20, guidance_scale=5.0).frames[0]path = tempfile.NamedTemporaryFile(suffix=".mp4", delete=False).nameexport_to_video(out, path, fps=FPS)return path
app.py+5-4