Sophnet Image Generate
Overview
Generate Sophnet images with Python scripts that handle task polling and structured output.
Script responsibilities:
generate_image.py: core API caller and polling loop, outputs machine-friendlyTASK_ID,STATUS, andIMAGE_URL.generate_and_preview.sh: wrapper for local use, callsgenerate_image.py, downloads first image, addsPREVIEW_PATH.
When to Use
- User asks to generate an image with Sophnet models.
- Caller needs stable outputs like
TASK_ID,STATUS,IMAGE_URL,PREVIEW_PATH. - Prompt includes model choice (
Z-Image-Turbo,Qwen-Image,Qwen-Image-Plus). - Do not use when the task is only to display an existing image URL/path; use
sophnet-smart-image-loader.
Quick Reference
| Goal | Command |
| --- | --- |
| Generate + local preview path | bash {baseDir}/scripts/generate_and_preview.sh --prompt "..." |
| Generate URLs only | uv run --project {baseDir} python {baseDir}/scripts/generate_image.py --prompt "..." |
| Show script options | uv run --project {baseDir} python {baseDir}/scripts/generate_image.py --help |
Recommended defaults:
- Use
generate_and_preview.shfor interactive local image preview. - Use
generate_image.pyfor automation/CI or when download is not needed.
Implementation
- Run the script with
--prompt. - Parse output lines by key prefix.
- Use
IMAGE_URLto share with users (publicly accessible). UsePREVIEW_PATHfor local image preview when present.
Common Mistakes
- Assuming
PREVIEW_PATHexists when usinggenerate_image.py.
微信扫一扫