diff --git a/app.py b/app.py index 8e4d8c0..ae5602e 100644 --- a/app.py +++ b/app.py @@ -7,6 +7,7 @@ import json treashold = float(os.getenv('FACE_TRASHOLD', '0.5')) sever = os.getenv('API_ROOT', 'localhost:8000') root_api_url = 'http://{}/local'.format(sever) +base_path = '/data/' try: while True: @@ -15,7 +16,7 @@ try: response = r.json() for detection in response: - img_path = "/data/{}".format(detection['source_image_path']) + img_path = "{}{}".format(base_path, detection['source_image_path']) #Skip Non existing files if (not os.path.exists(img_path)): @@ -41,12 +42,12 @@ try: i = i +1 extension = img_path[img_path.index(".")+1:] - new_img_path = img_path.replace(extension, ('_anonym{}'.format(extension))) + new_img_path = img_path.replace((".{}".format(extension)), ('_anonym.{}'.format(extension))) cv2.imwrite(new_img_path, img) data = { "id": detection['id'], - "source_image_path": new_img_path + "source_image_path": new_img_path.replace(base_path,"") } response = requests.post('{}/anonymize'.format(root_api_url), json=data) diff --git a/requirements.txt b/requirements.txt index 1db7aea..d397baf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ -opencv-python \ No newline at end of file +opencv-python +requests \ No newline at end of file