Downloads · 30 days
0
sergeipetrov/pix2pix-instruct-IE
pix2pix-instruct-IE is a image-to-image model from sergeipetrov. Use it when you need one image transformed into another. It is set up for generic.
Downloads · 30 days
0
Access
Public
Updated Feb 9, 2024
Repo size
—
Likes
1
Public
Click a slice to open those files.
.py1.9 KB · 44%
From the Hugging Face model README
Expected payload:
def predict(path_to_image, prompt):
with open(path_to_image, "rb") as i:
b64 = base64.b64encode(i.read()).decode()
payload = {
"inputs": b64,
"parameters": {
"prompt": prompt
}
}
response = r.post(
ENDPOINT_URL, json=payload, headers={"Content-Type": "application/json"}
)
return response.json()
Call it with:
resp = predict(
path_to_image="car.png",
prompt="make the car green"
)
img = Image.open(BytesIO(base64.b64decode(resp)))