Metadata-Version: 2.5
Name: z-vision-generator
Version: 0.13.0b21
Summary: Z-Vision Generator — cross-platform AI image and video generator
Project-URL: Homepage, https://github.com/knuthelge/ZVisionGenerator
Project-URL: Repository, https://github.com/knuthelge/ZVisionGenerator
Project-URL: Documentation, https://knuthelge.github.io/ZVisionGenerator/
Project-URL: Changelog, https://github.com/knuthelge/ZVisionGenerator/blob/main/CHANGELOG.md
Project-URL: Bug Tracker, https://github.com/knuthelge/ZVisionGenerator/issues
Author: Knut Risheim
License-Expression: AGPL-3.0-or-later
License-File: LICENSE
License-File: THIRD_PARTY_LICENSES.md
Keywords: ai,diffusers,flux,image-generation,mlx,stable-diffusion,video-generation,z-image
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Multimedia :: Video
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.14
Requires-Dist: accelerate>=1.15.0
Requires-Dist: av>=19.0.1; sys_platform != 'darwin'
Requires-Dist: bitsandbytes>=0.50.0; sys_platform != 'darwin'
Requires-Dist: diffusers==0.41.0
Requires-Dist: fastapi>=0.143.0
Requires-Dist: huggingface-hub<2.0,>=1.32.0
Requires-Dist: mflux<0.23,>=0.22.0; sys_platform == 'darwin'
Requires-Dist: mlx-arsenal<0.3,>=0.2.4; sys_platform == 'darwin'
Requires-Dist: mlx-lm>=0.32.0; sys_platform == 'darwin'
Requires-Dist: mlx>=0.32.2; sys_platform == 'darwin'
Requires-Dist: numpy>=2.0.0
Requires-Dist: peft>=0.21.2; sys_platform != 'darwin'
Requires-Dist: pillow>=12.3.0
Requires-Dist: psutil>=5.9.0
Requires-Dist: python-multipart>=0.0.32
Requires-Dist: pyyaml>=6.0.3
Requires-Dist: ruamel-yaml>=0.18.10
Requires-Dist: safetensors>=0.8.0
Requires-Dist: scipy>=1.17.0
Requires-Dist: torch>=2.14.0
Requires-Dist: tqdm>=4.66.0
Requires-Dist: transformers>=5.19.0
Requires-Dist: uvicorn>=0.54.0
Description-Content-Type: text/markdown

&nbsp;
<p align="center">
    <img src="https://raw.githubusercontent.com/knuthelge/ZVisionGenerator/main/docs/assets/ziv-logo.png" alt="Z-Vision Generator logo with the Blob mascot" width="360"/>
</p>
&nbsp;

# Z-Vision Generator

[![CI](https://github.com/knuthelge/ZVisionGenerator/actions/workflows/ci.yml/badge.svg)](https://github.com/knuthelge/ZVisionGenerator/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/z-vision-generator)](https://pypi.org/project/z-vision-generator/)
[![Python 3.14+](https://img.shields.io/badge/python-3.14%2B-blue)](https://www.python.org/downloads/)
[![License: AGPL-3.0](https://img.shields.io/badge/license-AGPL--3.0--or--later-blue)](LICENSE)

Local AI image and video generation — hassle-free and fun. No tangled node graphs, no cloud dependencies, just prompts and results. Runs on macOS (Apple Silicon / MLX) and on Windows and Linux with NVIDIA CUDA through diffusers.

## Features

- **Image generation** — text-to-image with Z-Image, FLUX.2 Klein (4B/9B) and Krea 2 Turbo model families, plus Ideogram 4 (FP8) on macOS/MLX
- **Video generation** — text-to-video and image-to-video with platform-specific LTX aliases across macOS, Windows, and Linux
- **Cross-platform** — automatic backend selection: MLX on macOS, diffusers/CUDA on Windows and Linux for images, and the shared diffusers/CUDA LTX backend on Windows and Linux for video
- **Prompt system** — YAML prompt files with variables, structured prompts, snippets, and batch runs
- **Model store** — central `~/.ziv/` directory with bare-name resolution and HuggingFace fallback
- **LoRA support** — single or stacked, configurable weights, bare-name resolution
- **Image upscale** — generate small → Lanczos → img2img refine → CAS sharpen
- **Video upscale** — `--upscale 2` renders at half size, upsamples the latents 2× and refines at full size, so the clip keeps the requested size, on macOS and on Windows/Linux
- **Reference images** — img2img steering from any starting image
- **Model variants** — image quantization across supported image backends, plus macOS MLX video Q4/Q8 aliases
- **Post-processing** — contrast, saturation, and CAS sharpening (image only)
- **Interactive controls** — skip, quit, pause, and repeat during image batch runs; Web UI video jobs can be cancelled

## Platform Support

| Platform | Image Generation | Video Generation |
|----------|------------------|------------------|
| macOS (Apple Silicon) | ✅ Z-Image / FLUX / Krea 2 / Ideogram 4 via mflux/MLX | ✅ LTX via MLX aliases (`ltx-4`, `ltx-8`) |
| Windows (NVIDIA GPU) | ✅ Z-Image / FLUX / Krea 2 via diffusers/CUDA | ✅ LTX via diffusers/CUDA aliases (`ltx-4`, `ltx-8`) |
| Linux (NVIDIA GPU) | ✅ Z-Image / FLUX / Krea 2 via diffusers/CUDA | ✅ LTX via diffusers/CUDA aliases (`ltx-4`, `ltx-8`) |

## Installation

Requires Python 3.14+ and [uv](https://docs.astral.sh/uv/).

> **uv is required.** This package cannot be installed with pip — some dependencies require uv-specific resolution that pip does not support. All commands below use uv.

```bash
# Install globally from PyPI
uv tool install z-vision-generator

# Install globally from repository
uv tool install -e git+https://github.com/knuthelge/ZVisionGenerator.git

# Development setup
git clone https://github.com/knuthelge/ZVisionGenerator && cd ZVisionGenerator
uv sync
```

> Video generation requires [ffmpeg](https://ffmpeg.org/). On Windows and Linux, image and video generation require an RTX 20-series (Turing) or newer NVIDIA GPU, including RTX 50-series, with NVIDIA driver 580 or newer, so that CUDA is available to PyTorch.

> Video uses `ltx-4` (4-bit) or `ltx-8` (8-bit) on every platform. On Windows and Linux they need about 20 GB and 27 GB of system memory. See the [Video Guide](docs/guides/video.md).

## Quick Start

```bash
# Generate an image (bare name from ~/.ziv/models/)
ziv-image -m my-model --prompt "a beautiful sunset"

# Generate from a HuggingFace model
ziv-image -m Tongyi-MAI/Z-Image-Turbo --prompt "a cat in a garden"

# Batch run from a prompts file
ziv-image -m my-model -p prompts.yaml -r 3

# Generate a video (4-bit LTX)
ziv-video -m ltx-4 --prompt "A cat walking through a garden"

# Image-to-video
ziv-video -m ltx-4 --image photo.jpg --prompt "Camera zooms in slowly"

# Launch the Web UI
ziv ui

# Show command help and available subcommands
ziv
```

The Web UI is an explicit local launcher: use `ziv ui` or `ziv-ui`. Running bare `ziv` prints command-discovery help without starting a browser or server. If a local environment is missing required Web UI packages, the launcher reports how to repair the base install instead of failing with an import traceback.

The packaged Web UI is served from local static files and does not fetch cloud fonts or other font assets at runtime. It uses local system font fallbacks when Inter or JetBrains Mono are not installed.

> **Tip:** `ziv image`, `ziv video`, and `ziv model` are also available as subcommands of the unified `ziv` parent command. Use `ziv -h` or `ziv --help` to print terminal help.

## Documentation

Full documentation is available at **[knuthelge.github.io/ZVisionGenerator](https://knuthelge.github.io/ZVisionGenerator/)**.

- [Getting Started](https://knuthelge.github.io/ZVisionGenerator/getting-started/) — installation, model store, quick start
- [Image Guide](https://knuthelge.github.io/ZVisionGenerator/guides/image/) — aliases, sizes, reference images, LoRA, upscaling, quantization
- [Video Guide](https://knuthelge.github.io/ZVisionGenerator/guides/video/) — T2V, I2V, upscale, audio, LoRA, constraints
- [Prompts Guide](https://knuthelge.github.io/ZVisionGenerator/guides/prompts/) — prompt files, variables, structured prompts, snippets
- [Model & LoRA Guide](https://knuthelge.github.io/ZVisionGenerator/guides/model/) — checkpoint conversion, LoRA import, asset listing
- [CLI Reference](https://knuthelge.github.io/ZVisionGenerator/reference/cli/) — full argument tables for all commands
- [Development](https://knuthelge.github.io/ZVisionGenerator/development/) — setup, testing, architecture

## Contributing

Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

## License

This project is licensed under the [GNU Affero General Public License v3.0 or later](LICENSE).
