import requests import base64, torch from io import BytesIO import numpy as np import json from json import loads, dumps import matplotlib.pyplot as plt import cv2 def resize_image(image): w, h = image.size print(w, h) max_w = 700 max_h = 700 if max_wh: new_w = max_w new_h = int(h*(max_w/w)) image = image.resize((new_w,new_h), Image.LANCZOS) elif max_h