示例#1
0
async def logo_detection(files: List[UploadFile] = File(...)):
    response = None
    try:
        image_processor = ImageProcessor()
        data = json.dumps({image_processor.detect_logos(files[0])})
        response = Response(content=data, media_type="application/json")
    except Exception as error:
        logging.error("Error while uploading file ", str(error))
        response = {"Error ": str(error)}

    return response
示例#2
0
    def test_detect_logos(self):
        images = [
            "altroz.png", "cred.png", "dream11.png", "paytm.png",
            "unacademy.png"
        ]
        image_processor = ImageProcessor()

        for image in images:
            detected_logos = image_processor.detect_logos(image)
            detected_logo_names = [logo['name'] for logo in detected_logos]
            brand_name = image.split(".")[0]
            self.assertIn(brand_name, detected_logo_names)