From e1dba908e7dcd19a923b283e4e8392add033972a Mon Sep 17 00:00:00 2001 From: Guillermo Rodriguez Date: Sat, 7 Jan 2023 09:05:17 -0300 Subject: [PATCH] Fix bug where we only supported square imgs on telegram frontend reply --- skynet/frontend/telegram.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/skynet/frontend/telegram.py b/skynet/frontend/telegram.py index a209032..f53a116 100644 --- a/skynet/frontend/telegram.py +++ b/skynet/frontend/telegram.py @@ -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)