Spaces:
Running on Zero
Running on Zero
Image model: Z-Image Turbo (Apache-2.0, not gated) so both models fit the default ZeroGPU size
Browse filesFiles changed (3)
- README.md+1-1
- app.py+4-4
- requirements.txt+1-1
15 unmodified lines1617181920212215 unmodified lines| Endpoint | Inputs | Output | Model || --- | --- | --- | --- || `/image` | prompt, aspect ratio (9:16, 16:9, 1:1, 4:5) | image | FLUX.1 [schnell] (Apache-2.0) || `/video` | prompt, start image, seconds (2 to 5) | video, 24 fps, up to 5 s | Wan 2.2 TI2V-5B (Apache-2.0) |Hardware: ZeroGPU. Both models allow commercial use of the generated images and videos.15 unmodified lines1617181920212215 unmodified lines| Endpoint | Inputs | Output | Model || --- | --- | --- | --- || `/image` | prompt, aspect ratio (9:16, 16:9, 1:1, 4:5) | image | Z-Image Turbo by Alibaba Tongyi (Apache-2.0) || `/video` | prompt, start image, seconds (2 to 5) | video, 24 fps, up to 5 s | Wan 2.2 TI2V-5B (Apache-2.0) |Hardware: ZeroGPU. Both models allow commercial use of the generated images and videos.
7 unmodified lines891011121314151617181920214 unmodified lines262728293031327 unmodified linesimport gradio as grimport spacesimport torchfrom diffusers import FluxPipeline, WanImageToVideoPipeline, AutoencoderKLWanfrom diffusers.utils import export_to_videofrom PIL import ImageIMAGE_MODEL = "black-forest-labs/FLUX.1-schnell" # Apache-2.0VIDEO_MODEL = "Wan-AI/Wan2.2-TI2V-5B-Diffusers" # Apache-2.0image_pipe = FluxPipeline.from_pretrained(IMAGE_MODEL, torch_dtype=torch.bfloat16).to("cuda")vae = AutoencoderKLWan.from_pretrained(VIDEO_MODEL, subfolder="vae", torch_dtype=torch.float32)video_pipe = WanImageToVideoPipeline.from_pretrained(VIDEO_MODEL, vae=vae, torch_dtype=torch.bfloat16).to("cuda")4 unmodified lines@spaces.GPU(duration=30)def image(prompt: str, aspect: str):w, h = SIZES.get(aspect, SIZES["9:16"])out = image_pipe(prompt, width=w, height=h, num_inference_steps=4, guidance_scale=0.0).images[0]path = tempfile.NamedTemporaryFile(suffix=".png", delete=False).nameout.save(path)return path7 unmodified lines891011121314151617181920214 unmodified lines262728293031327 unmodified linesimport gradio as grimport spacesimport torchfrom diffusers import ZImagePipeline, WanImageToVideoPipeline, AutoencoderKLWanfrom diffusers.utils import export_to_videofrom PIL import ImageIMAGE_MODEL = "Tongyi-MAI/Z-Image-Turbo" # Apache-2.0, not gatedVIDEO_MODEL = "Wan-AI/Wan2.2-TI2V-5B-Diffusers" # Apache-2.0image_pipe = ZImagePipeline.from_pretrained(IMAGE_MODEL, torch_dtype=torch.bfloat16).to("cuda")vae = AutoencoderKLWan.from_pretrained(VIDEO_MODEL, subfolder="vae", torch_dtype=torch.float32)video_pipe = WanImageToVideoPipeline.from_pretrained(VIDEO_MODEL, vae=vae, torch_dtype=torch.bfloat16).to("cuda")4 unmodified lines@spaces.GPU(duration=30)def image(prompt: str, aspect: str):w, h = SIZES.get(aspect, SIZES["9:16"])out = image_pipe(prompt=prompt, width=w, height=h, num_inference_steps=9, guidance_scale=0.0).images[0] # 8 DiT steps, no guidance (Turbo)path = tempfile.NamedTemporaryFile(suffix=".png", delete=False).nameout.save(path)return path
12345torchdiffusers>=0.35.0transformersacceleratesentencepiece12345torchdiffusers>=0.36.0transformersacceleratesentencepiece
README.md+1-1
app.py+4-4
requirements.txt+1-1