Fix
This commit is contained in:
@@ -7,6 +7,7 @@ import json
|
|||||||
treashold = float(os.getenv('FACE_TRASHOLD', '0.5'))
|
treashold = float(os.getenv('FACE_TRASHOLD', '0.5'))
|
||||||
sever = os.getenv('API_ROOT', 'localhost:8000')
|
sever = os.getenv('API_ROOT', 'localhost:8000')
|
||||||
root_api_url = 'http://{}/local'.format(sever)
|
root_api_url = 'http://{}/local'.format(sever)
|
||||||
|
base_path = '/data/'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
@@ -15,7 +16,7 @@ try:
|
|||||||
response = r.json()
|
response = r.json()
|
||||||
|
|
||||||
for detection in response:
|
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
|
#Skip Non existing files
|
||||||
if (not os.path.exists(img_path)):
|
if (not os.path.exists(img_path)):
|
||||||
@@ -41,12 +42,12 @@ try:
|
|||||||
i = i +1
|
i = i +1
|
||||||
|
|
||||||
extension = img_path[img_path.index(".")+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)
|
cv2.imwrite(new_img_path, img)
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"id": detection['id'],
|
"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)
|
response = requests.post('{}/anonymize'.format(root_api_url), json=data)
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -1 +1,2 @@
|
|||||||
opencv-python
|
opencv-python
|
||||||
|
requests
|
||||||
Reference in New Issue
Block a user