Closed mix1009 closed 1 year ago
Created /instruct-pix2pix/img2img API endpoint :)
Demo API usage using webuiapi (pip install webuiapi)
import webuiapi api = webuiapi.WebUIApi() import io import base64 from PIL import Image def b64_img(image: Image): buffered = io.BytesIO() image.save(buffered, format="PNG") img_base64 = 'data:image/png;base64,' + str(base64.b64encode(buffered.getvalue()), 'utf-8') return img_base64
api.util_set_model('model.ckpt') r = api.txt2img(prompt='a cute puppy in the park') img = r.image img
api.util_set_model('instruct-pix2pix') payload = {} payload['init_images'] = [b64_img(img)] payload['prompt'] = 'sunset' payload['text_cfg'] = 7.5 payload['img_cfg'] = 1.5 payload['sampler'] = 'Euler a' r = api.custom_post('instruct-pix2pix/img2img', payload=payload, baseurl=False) r.image
Created /instruct-pix2pix/img2img API endpoint :)
Demo API usage using webuiapi (pip install webuiapi)