17
app/litserve/client.py
Executable file
17
app/litserve/client.py
Executable file
@@ -0,0 +1,17 @@
|
||||
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"]))
|
||||
Reference in New Issue
Block a user