Flux API , payload for the text2img API #2769
Unanswered
ngochoang0105
asked this question in
Q&A
Replies: 2 comments
-
did you end up figuring this out? |
Beta Was this translation helpful? Give feedback.
0 replies
-
found it ... call the options end point with this payload sdapi/v1/options (in your case for flux in my case for sdxl)
Now looking how to unload the model immediately after finishing generation |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
How can I add all the "VAE / Text Encoder" parameters to the API payload? I can't find it in the documentation! The result is always a black image. Here is my code.
`import requests
import base64
from PIL import Image
from io import BytesIO
import os
import json
web_ui_url = "http://127.0.0.1:7860"
payload = {
"prompt": "1girl",
"seed": -1,
"steps": 20,
"cfg_scale": 1,
"width": 512 ,
"height": 512,
"batch_size": 1,
"n_iter": 1,
"sampler_index": "Euler",
"schedule_type": "Simple",
"send_images": True,
"save_images": False,
}
response = requests.post(f"{web_ui_url}/sdapi/v1/txt2img", json=payload)
if response.status_code == 200:
json_data = response.json()
image_base64 = json_data['images'][0]
image_bytes = base64.b64decode(image_base64)
image = Image.open(BytesIO(image_bytes))
image.show()`
Beta Was this translation helpful? Give feedback.
All reactions