mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
fix api generate save metadata
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
- Model load from dropdown select variant
|
||||
- VAE preview
|
||||
- SC LoRA
|
||||
- Gallery urlencode/decode
|
||||
|
||||
## Update for 2024-03-23
|
||||
|
||||
@@ -28,6 +29,7 @@
|
||||
- Prompt params parser
|
||||
- Fix image save without metadata
|
||||
- fix ROCm compatibility, thanks @Disty0
|
||||
- Fix API generate save metadata
|
||||
|
||||
## Update for 2024-03-19
|
||||
|
||||
|
||||
@@ -12,16 +12,15 @@ from PIL import Image
|
||||
sd_url = os.environ.get('SDAPI_URL', "http://127.0.0.1:7860")
|
||||
sd_username = os.environ.get('SDAPI_USR', None)
|
||||
sd_password = os.environ.get('SDAPI_PWD', None)
|
||||
options = {
|
||||
"save_images": True,
|
||||
"send_images": True,
|
||||
}
|
||||
|
||||
logging.basicConfig(level = logging.INFO, format = '%(asctime)s %(levelname)s: %(message)s')
|
||||
log = logging.getLogger(__name__)
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
options = {
|
||||
"save_images": False,
|
||||
"send_images": True,
|
||||
}
|
||||
|
||||
|
||||
def auth():
|
||||
if sd_username is not None and sd_password is not None:
|
||||
|
||||
@@ -36,8 +36,7 @@ def encode_pil_to_base64(image):
|
||||
shared.log.error('API cannot encode image: not a PIL image')
|
||||
return ''
|
||||
buffered = io.BytesIO()
|
||||
image_format = Image.registered_extensions()[f'.{shared.opts.samples_format}']
|
||||
image.save(buffered, format=image_format)
|
||||
save_image(image, fn=buffered, ext=shared.opts.samples_format)
|
||||
b64 = base64.b64encode(buffered.getvalue())
|
||||
return b64
|
||||
|
||||
|
||||
Reference in New Issue
Block a user