Merge pull request #2 from guilledk/fix_rectangular_imgs

Fix bug where we only supported square imgs on telegram frontend reply
pull/3/head
Guillermo Rodriguez 2023-01-07 09:06:02 -03:00 committed by GitHub
commit 83465aadaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -113,10 +113,10 @@ async def run_skynet_telegram(
logging.info(result['id'])
img_raw = zlib.decompress(bytes.fromhex(result['img']))
logging.info(f'got image of size: {len(img_raw)}')
size = (512, 512)
meta = result['meta']['meta']
size = (int(meta['width']), int(meta['height']))
if meta['upscaler'] == 'x4':
size = (2048, 2048)
size = (size[0] * 4, size[1] * 4)
img = Image.frombytes('RGB', size, img_raw)
@ -147,10 +147,10 @@ async def run_skynet_telegram(
logging.info(result['id'])
img_raw = zlib.decompress(bytes.fromhex(result['img']))
logging.info(f'got image of size: {len(img_raw)}')
size = (512, 512)
meta = result['meta']['meta']
size = (int(meta['width']), int(meta['height']))
if meta['upscaler'] == 'x4':
size = (2048, 2048)
size = (size[0] * 4, size[1] * 4)
img = Image.frombytes('RGB', size, img_raw)
@ -176,7 +176,7 @@ async def run_skynet_telegram(
'config', {'attr': attr, 'val': val})
except BaseException as e:
reply_text = str(e.value)
reply_txt = str(e)
finally:
await bot.reply_to(message, reply_txt)