This commit is contained in:
Imendin
2024-10-01 18:31:23 +02:00
parent 9a2afed1f1
commit ce60f05432
2 changed files with 6 additions and 4 deletions
+4 -3
View File
@@ -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)