Upload handler.py
Browse files5 unmodified lines6789101160 unmodified lines7273747576775 unmodified linesfrom ultralytics import YOLOimport osimport gdownclass EndpointHandler:def __init__(self, path='.'): # pass api key to model60 unmodified linescv2.imwrite("result.jpg", clothes)# create base 64 objectjpg_as_text = base64.b64encode(buffer).decode("utf-8") # Decode bytes to string")print("checkpoint 4")###########################################################################return jpg_as_text5 unmodified lines67891011121360 unmodified lines7475767778798081828384858687885 unmodified linesfrom ultralytics import YOLOimport osimport gdownfrom PIL import Imageimport ioclass EndpointHandler:def __init__(self, path='.'): # pass api key to model60 unmodified linescv2.imwrite("result.jpg", clothes)# create base 64 objectjpg_as_text = base64.b64encode(buffer).decode("utf-8") # Decode bytes to string")# base64_encoded = base64.b64encode(image_bytes).decode("utf-8")# Get the image formatimage_format = Image.open(io.BytesIO(buffer)).format.lower()# Construct the data URIdata_uri = f"data:image/{image_format};base64,{jpg_as_text}"return data_uriprint("checkpoint 4")###########################################################################return jpg_as_text
handler.py+11