Fixing more telegram deseralization errors

pull/4/head
Guillermo Rodriguez 2023-01-16 00:35:33 -03:00
parent b922232840
commit e916188b93
No known key found for this signature in database
GPG Key ID: EC3AB66D5D83B392
1 changed files with 1 additions and 16 deletions

View File

@ -113,12 +113,7 @@ 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)}')
meta = result['meta']['meta'] img = Image.open(io.BytesIO(img_raw))
size = (int(meta['width']), int(meta['height']))
if meta['upscaler'] == 'x4':
size = (size[0] * 4, size[1] * 4)
img = Image.frombytes('RGB', size, img_raw)
await bot.send_photo( await bot.send_photo(
message.chat.id, message.chat.id,
@ -164,11 +159,6 @@ 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)}')
meta = result['meta']['meta']
size = (int(meta['width']), int(meta['height']))
if meta['upscaler'] == 'x4':
size = (size[0] * 4, size[1] * 4)
img = Image.open(io.BytesIO(img_raw)) img = Image.open(io.BytesIO(img_raw))
await bot.send_photo( await bot.send_photo(
@ -198,11 +188,6 @@ 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)}')
meta = result['meta']['meta']
size = (int(meta['width']), int(meta['height']))
if meta['upscaler'] == 'x4':
size = (size[0] * 4, size[1] * 4)
img = Image.open(io.BytesIO(img_raw)) img = Image.open(io.BytesIO(img_raw))
await bot.send_photo( await bot.send_photo(