Z-Image / README.md
bened's picture
Upload 6 files
7cbae35 verified
|
Raw
History Blame Contribute Delete
2.16 kB
---
title: Z-Image + Watermark Remover V5
emoji: 🎨
colorFrom: yellow
colorTo: purple
sdk: gradio
sdk_version: 5.23.1
python_version: "3.10"
app_file: app.py
startup_duration_timeout: 30m
---
# Z-Image + Watermark Remover V5.1
ZeroGPU Gradio Space combining Z-Image-Turbo, Florence-2 watermark detection and LaMa image/video watermark removal.
## V5 fixes
- Removes the invalid `@spaces.GPU(duration=300/450)` video request.
- Uses a maximum 120-second ZeroGPU request for video, matching the documented custom-duration example/cap used by ZeroGPU tiers.
- Adds a preflight video duration check and rejects videos that are too long for a single ZeroGPU request instead of submitting a request that will certainly fail.
- Default maximum input video length: 45 seconds. Set `WATERMARK_MAX_VIDEO_SECONDS` in Space Variables if you want a different limit; keep it realistic for the 120-second GPU request.
- Optimizes LaMa video processing by inpainting only the watermark bounding regions instead of the entire frame.
- Keeps the original audio stream with FFmpeg.
- Keeps V3/V4 Florence-2 compatibility patch and writable-cache fallback.
- Keeps Gradio API endpoints: `generate_image`, `watermark_preview`, `remove_image`, `remove_video`.
## Important ZeroGPU behavior
A single `@spaces.GPU` invocation is one GPU reservation. Splitting a video into files inside that same function does **not** release the GPU between chunks. Therefore V5 does not falsely claim to provide multiple independent GPU reservations for one click. Instead it uses a bounded single-request video mode and fails early with a clear message when the input is too long.
For longer videos, use the API/UI to process shorter clips separately and concatenate them locally, or move the workload to a dedicated GPU Space.
## Deployment
Upload the files to the root of a Gradio ZeroGPU Space. Gradio is managed by the Space `sdk_version`; do not pin Gradio in `requirements.txt`.
Set `HF_TOKEN` as a Space Secret for authenticated Hub downloads if desired.
## V5.1 dependency fix
Florence-2 dynamically imports `einops` and `timm`. V5.1 adds both packages to `requirements.txt`.