Add log output, to see which drawing enginge was used.

This commit is contained in:
Fjerkroa Auto 2023-08-19 21:23:41 +02:00
parent 4ec20f1b26
commit 8a5cef4deb

View File

@ -150,6 +150,7 @@ class AIResponder(object):
response = await openai.Image.acreate(prompt=description, n=1, size="512x512") response = await openai.Image.acreate(prompt=description, n=1, size="512x512")
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
async with session.get(response['data'][0]['url']) as image: async with session.get(response['data'][0]['url']) as image:
logging.info(f'Drawed a picture with DALL-E on this description: {repr(description)}')
return BytesIO(await image.read()) return BytesIO(await image.read())
except Exception as err: except Exception as err:
logging.warning(f"Failed to generate image {repr(description)}: {repr(err)}") logging.warning(f"Failed to generate image {repr(description)}: {repr(err)}")
@ -190,6 +191,7 @@ class AIResponder(object):
headers={"Authorization": f"Bearer {self.config['leonardo-token']}"}, headers={"Authorization": f"Bearer {self.config['leonardo-token']}"},
) as response: ) as response:
await response.json() await response.json()
logging.info(f'Drawed a picture with leonardo AI on this description: {repr(description)}')
return image_bytes return image_bytes
except Exception as err: except Exception as err:
logging.warning(f"Failed to generate image: {repr(err)}") logging.warning(f"Failed to generate image: {repr(err)}")