Files
FiDA-Gen-Img-Flux2-klein/app/litserve/client.py
zcr b3eda2f7c7
Some checks failed
CI / lint (push) Failing after 11s
1
2026-03-18 11:09:01 +08:00

18 lines
487 B
Python
Executable File

import requests
import base64
# 将你的图片转为 base64
with open("/mnt/data/workspace/Code/flux2/20260123_152354_2steps.png", "rb") as f:
img_base64 = base64.b64encode(f.read()).decode("utf-8")
response = requests.post("http://localhost:8451/predict", json={
# "image": img_base64,
"prompt": "紫色实木窗帘",
"aspect_ratio": "1:1",
"steps": 4
})
# 保存结果
with open("result.png", "wb") as f:
f.write(base64.b64decode(response.json()["image"]))