31 lines
1.7 KiB
Markdown
31 lines
1.7 KiB
Markdown
# Renderer adapters
|
|
|
|
`render_batch.py` talks to the renderer through one function:
|
|
|
|
```python
|
|
def submit(job, refs, spec, env):
|
|
"""job: one entry of jobs.json (id, prompt, size, refs, prompt_alt)
|
|
refs: absolute paths of the reference images, IMAGE 1 first (the plate), then style/material refs
|
|
spec: the jobs.json header (model, quality, ...)
|
|
env: {"key": IMAGE_API_KEY, "base": IMAGE_API_BASE}
|
|
returns (status_code, png_bytes_or_None, error_body_text, response_headers_or_{})"""
|
|
```
|
|
|
|
The built-in `openai_images` adapter posts to an OpenAI-compatible `/images/edits` endpoint (multipart, `image[]`
|
|
for every reference, `prompt`, `size`, `quality`, `output_format=png`). Jobs with no references go to
|
|
`/images/generations`.
|
|
|
|
What the method needs from a renderer, in order of importance:
|
|
|
|
1. **Image-conditioned editing with several references** where the first image is treated as the scene to re-surface
|
|
and the others as material/style references. The plate must dominate the layout.
|
|
2. **A 16:9 output at 2048x1152 or similar** so the plate-to-frame registration is pixel-comparable.
|
|
3. **No seed and no strength dial is fine.** The method never relied on either: geometry is held by the plate and the
|
|
prompt, variance is handled by rendering 2-4 takes and gating.
|
|
4. **A rate-limit indicator** (HTTP 429 with Retry-After, or any 5xx) so the batch runner can calibrate concurrency.
|
|
|
|
Return 429/5xx for "try later" conditions and any other non-200 for a hard failure. A body containing
|
|
`safety`, `moderation`, `content_policy` or `rejected` triggers the one allowed rephrase (`prompt_alt`).
|
|
|
|
Drop your adapter in this directory as `<name>.py` and run `render_batch.py --adapter <name>`.
|