Fix
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
+2
-1
@@ -1 +1,2 @@
|
||||
opencv-python
|
||||
opencv-python
|
||||
requests
|
||||
Reference in New Issue
Block a user