Files
image-gen/README.md
2026-04-15 18:46:00 +08:00

88 lines
2.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Z-Image-Turbo
🎨 **极速 AI 图像生成应用** — 基于 [Z-Image-Turbo](https://huggingface.co/openai/z-image-turbo) 模型,仅需 8 步即可生成精美图像。
[![Gradio](https://img.shields.io/badge/Gradio-6.0+-yellow)](https://gradio.app/)
[![Python](https://img.shields.io/badge/Python-3.12+-blue)](https://www.python.org/)
[![uv](https://img.shields.io/badge/uv-managed-purple)](https://docs.astral.sh/uv/)
---
## 功能特性
-**极速生成** — 8 步 DiT 前向传播即可生成高质量图像
- 🖼️ **自定义尺寸** — 支持 512~2048 像素范围的图像尺寸
- 🎲 **种子控制** — 支持固定种子或随机种子,便于复现结果
- 💡 **示例提示词** — 内置丰富的中文示例提示词
- 🌐 **远程 API 调用** — 通过 OpenAI 兼容 API 调用图像生成服务
- 🎨 **现代 UI** — 基于 Gradio 6 的现代化界面,支持响应式布局
---
## 快速开始
### 环境要求
- Python >= 3.12
- [uv](https://docs.astral.sh/uv/) 包管理器
### 安装依赖
```bash
uv sync
```
### 配置环境变量
创建 `.env` 文件:
```env
IMAGE_API_URL=https://llm.dev.maimaiag.com/v1/images/generations
IMAGE_API_KEY=your-api-key-here
```
### 启动应用
```bash
uv run python app.py
```
应用启动后,默认在本地 `http://127.0.0.1:7860` 运行。
---
## 项目结构
```
.
├── app.py # Gradio 应用主入口
├── pyproject.toml # uv 项目配置与依赖
├── requirements.txt # 备用依赖列表Gradio Space 兼容)
├── .env # 环境变量(需自行创建,不提交到仓库)
└── README.md # 本文件
```
---
## 技术栈
- **前端/UI**: [Gradio 6](https://gradio.app/)
- **后端**: Python 3.12+
- **包管理**: [uv](https://docs.astral.sh/uv/)
- **图像处理**: Pillow
- **API 协议**: OpenAI 兼容的 Images Generations API
---
## 部署
本项目可直接部署到 [Hugging Face Spaces](https://huggingface.co/spaces) 或其他支持 Gradio 的平台。
Space 配置参考 `README.md` 顶部的 YAML Front Matter保留在原始文件中用于 Hugging Face 识别)。
---
## 许可证
MIT License