Update README with generate and serve commands

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Adam Ladachowski
2026-02-12 20:24:06 +00:00
parent 503274a938
commit b33fe120fa
+54 -2
View File
@@ -2,7 +2,7 @@
# tensors
A CLI tool for working with safetensor files and CivitAI models.
A CLI tool for working with safetensor files, CivitAI models, and stable-diffusion.cpp image generation.
## Features
@@ -12,6 +12,8 @@ https://github.com/user-attachments/assets/2e7629b4-34e7-4cbc-b50e-31d7fdd30239
- **CivitAI integration** - Search models, fetch info, identify files by hash
- **Download models** - Resume support, type-based default paths
- **Hash verification** - SHA256 computation with progress display
- **Image generation** - txt2img/img2img via stable-diffusion.cpp server
- **Server wrapper** - FastAPI wrapper for sd-server process management
## Installation
@@ -23,6 +25,9 @@ uv sync
# Or install directly
uv pip install git+https://github.com/aladac/tensors.git
# With server wrapper support
pip install tensors[server]
```
## Usage
@@ -82,6 +87,36 @@ tsr info model.safetensors -j
tsr info model.safetensors --save-to ./metadata
```
### Generate Images
Requires a running [stable-diffusion.cpp](https://github.com/leejet/stable-diffusion.cpp) server.
```bash
# Generate an image
tsr generate "a cat sitting on a roof"
# Custom size, steps, and output
tsr generate "sunset over mountains" -W 768 -H 512 --steps 30 -o ./output
# Multiple images with seed
tsr generate "cyberpunk city" -b 4 -s 42
# With sampler and negative prompt
tsr generate "portrait" --sampler euler_a -n "blurry, low quality"
```
### Server Wrapper
Manage sd-server process via a REST API. Requires `pip install tensors[server]`.
```bash
# Start the wrapper API
tsr serve
# Custom host and port
tsr serve --host 0.0.0.0 --port 9000
```
### Configuration
```bash
@@ -125,6 +160,23 @@ Models are downloaded to XDG-compliant paths:
| `-s, --sort` | downloads, rating, newest |
| `-n, --limit` | Number of results (default: 20) |
## Generate Options
| Option | Description |
|--------|-------------|
| `-W` | Image width (default: 512) |
| `-H` | Image height (default: 512) |
| `--steps` | Sampling steps (default: 20) |
| `--cfg-scale` | CFG scale (default: 7.0) |
| `-s` | RNG seed, -1 for random (default: -1) |
| `-b` | Batch size / number of images (default: 1) |
| `-n` | Negative prompt |
| `-o` | Output directory (default: .) |
| `--sampler` | Sampler name |
| `--scheduler` | Scheduler name |
| `--host` | sd-server address (default: 127.0.0.1) |
| `--port` | sd-server port (default: 1234) |
## Development
```bash
@@ -139,7 +191,7 @@ uv run ruff check .
uv run ruff format .
# Type check
uv run mypy tensors.py
uv run mypy tensors/
```
## License