mirror of https://github.com/skygpu/skynet.git
Fix bug where we only supported square imgs on telegram frontend reply
parent
064c78874b
commit
e1dba908e7
|
@ -113,10 +113,10 @@ async def run_skynet_telegram(
|
||||||
logging.info(result['id'])
|
logging.info(result['id'])
|
||||||
img_raw = zlib.decompress(bytes.fromhex(result['img']))
|
img_raw = zlib.decompress(bytes.fromhex(result['img']))
|
||||||
logging.info(f'got image of size: {len(img_raw)}')
|
logging.info(f'got image of size: {len(img_raw)}')
|
||||||
size = (512, 512)
|
|
||||||
meta = result['meta']['meta']
|
meta = result['meta']['meta']
|
||||||
|
size = (int(meta['width']), int(meta['height']))
|
||||||
if meta['upscaler'] == 'x4':
|
if meta['upscaler'] == 'x4':
|
||||||
size = (2048, 2048)
|
size = (size[0] * 4, size[1] * 4)
|
||||||
|
|
||||||
img = Image.frombytes('RGB', size, img_raw)
|
img = Image.frombytes('RGB', size, img_raw)
|
||||||
|
|
||||||
|
@ -147,10 +147,10 @@ async def run_skynet_telegram(
|
||||||
logging.info(result['id'])
|
logging.info(result['id'])
|
||||||
img_raw = zlib.decompress(bytes.fromhex(result['img']))
|
img_raw = zlib.decompress(bytes.fromhex(result['img']))
|
||||||
logging.info(f'got image of size: {len(img_raw)}')
|
logging.info(f'got image of size: {len(img_raw)}')
|
||||||
size = (512, 512)
|
|
||||||
meta = result['meta']['meta']
|
meta = result['meta']['meta']
|
||||||
|
size = (int(meta['width']), int(meta['height']))
|
||||||
if meta['upscaler'] == 'x4':
|
if meta['upscaler'] == 'x4':
|
||||||
size = (2048, 2048)
|
size = (size[0] * 4, size[1] * 4)
|
||||||
|
|
||||||
img = Image.frombytes('RGB', size, img_raw)
|
img = Image.frombytes('RGB', size, img_raw)
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ async def run_skynet_telegram(
|
||||||
'config', {'attr': attr, 'val': val})
|
'config', {'attr': attr, 'val': val})
|
||||||
|
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
reply_text = str(e.value)
|
reply_txt = str(e)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
await bot.reply_to(message, reply_txt)
|
await bot.reply_to(message, reply_txt)
|
||||||
|
|
Loading…
Reference in New Issue