Skip to content
Discussion options

You must be logged in to vote

mask should be a base64-encoded image. Remove it if you're not using one.

Any other settings you're not using can be removed as well. This extension can help you create payloads.

You could also read the image from a file instead of hardcoding it, like this:

import requests
import base64

# Read input image
with open("input.png", "rb") as f:
    img = base64.b64encode(f.read()).decode("utf-8")

payload = {
    "prompt": "hot air balloon",
    "init_images": [img],
}

# send payload
response = requests.post(url="http://127.0.0.1:7860/sdapi/v1/img2img", json=payload)
r = response.json()

# Save output image
with open("output.png", "wb") as f:
    f.write(base64.b64decode(r["images"][0]))

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@PratikG7529
Comment options

@missionfloyd
Comment options

Answer selected by PratikG7529
@PratikG7529
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants