imgdata ='data:image/jpg;base64,'+ base64.b64encode(jpgbytes).decode('ascii')elifencoding=='png': pngbytes = cv2.imencode('.png', img)[1] imgdata ='data:image/png;base64,'+ base64.b64encode(pngbytes).decode('ascii')else:raiseValueError('unknown encoding') send(command='image', ...
import uvicorn from fastapi import FastAPI, Request ,Depends import cv2 import io from time import sleep import PIL.Image as Image import numpy as np import base64 import tensorflow as tf import nest_asyncio import concurrent.futures from concurrent.futures import ThreadPoolExecutor import multiprocessi...