1
0
mirror of https://github.com/osmarks/meme-search-engine.git synced 2024-11-10 22:09:54 +00:00
This commit is contained in:
osmarks 2023-09-29 18:34:06 +01:00
parent 33f4382146
commit 120edc1a47

6
mse.py
View File

@ -11,6 +11,7 @@ import numpy
import os
import aiohttp_cors
import json
import io
import sys
with open(sys.argv[1], "r") as config_file:
@ -118,9 +119,10 @@ class Index:
st = os.stat(path)
if st.st_mtime != files.get(file):
try:
im = Image.open(path).resize(self.inference_server_config["image_size"]).convert("RGB")
im = Image.open(path)
im.draft("RGB", self.inference_server_config["image_size"])
buf = io.BytesIO()
im.save(buf, format="BMP")
im.resize(self.inference_server_config["image_size"]).convert("RGB").save(buf, format="BMP")
b = buf.getvalue()
except Exception as e:
print(file, "failed", e)