Add local FLUX image editing

This commit is contained in:
Mikei386 committed 2026-08-30 22:11:26 +02:00
1 parent 40e73d82a8
commit c27636ac34
13 files changed
+209 -64

No files matched your search

+27
View File
@@ -343,6 +343,33 @@ CTYPE=$(grep -i content-type /tmp/hdr12.txt | tr -d "\r")
[ "$CODE" = "200" ] && [ -s /tmp/test_dl.png ] && echo "$CTYPE" | grep -qi "image/png" \
&& ok "PNG-Download (200, $CTYPE)" || bad "PNG-Download (Code $CODE, $CTYPE)"
# --- 12b. Referenzbild-Bearbeitung ------------------------------------------------------
echo "== Test 12b: POST /v1/images/edits mit lokalem Referenzbild"
python3 - <<'PY' >/tmp/edit-request.json
import base64, json
png = open('/tmp/test_dl.png', 'rb').read()
print(json.dumps({
'prompt': 'Behalte die Person bei und ändere nur den Hintergrund',
'size': '1024x1024',
'steps': 4,
'guidance': 1.0,
'response_format': 'b64_json',
'image_b64': base64.b64encode(png).decode(),
}))
PY
rm -f /tmp/test_worker_requests.jsonl
RESP=$(curl -sf "$BASE/v1/images/edits" -H "Content-Type: application/json" \
--data-binary @/tmp/edit-request.json)
echo "$RESP" | python3 -c '
import base64,json,sys
d=json.load(sys.stdin)
assert base64.b64decode(d["data"][0]["b64_json"])[:4] == b"\x89PNG"
' || bad "Bildbearbeitung liefert kein PNG"
REFS=$(tail -1 /tmp/test_worker_requests.jsonl | python3 -c \
'import json,sys; print(len(json.load(sys.stdin).get("source_files", [])))')
[ "$REFS" = "1" ] && ! find /tmp/test-images -name '.edit-*.ref' | grep -q . \
&& ok "Referenzbild übergeben und danach gelöscht" || bad "Referenzbild-Pfad/Cleanup"
# --- 13. Bild-Liste ---------------------------------------------------------------------
echo "== Test 13: GET /images"
RESP=$(curl -sf "$BASE/images")