From f1b1032b12904b24838ff686541006d06c52ea7c Mon Sep 17 00:00:00 2001 From: SadhulaSaiKumar Date: Mon, 4 Sep 2023 07:22:17 +0000 Subject: [PATCH] Upload files to 'Attendence' --- Attendence/uat_attendence.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Attendence/uat_attendence.py b/Attendence/uat_attendence.py index 2c3c1e4..fa7af18 100644 --- a/Attendence/uat_attendence.py +++ b/Attendence/uat_attendence.py @@ -8,7 +8,8 @@ import os app = Flask(__name__) #CORS(app) lst = [] - +Gallery="Gallery" +People='People' @app.route('/', methods=['GET']) def resume(): @@ -40,8 +41,8 @@ def registered(url_list): input=url_list from pathlib import Path - Path("ppeople").mkdir(exist_ok=True) - Path("ppeople/" + input["FileName"]).mkdir(exist_ok=True) + Path(People).mkdir(exist_ok=True) + Path(People+"/" + input["FileName"]).mkdir(exist_ok=True) a = input # print(a) @@ -66,11 +67,11 @@ def registered(url_list): import base64 - with open("ppeople/" + input["FileName"] + "/" + name, "wb") as fh: + with open(People+"/" + input["FileName"] + "/" + name, "wb") as fh: fh.write(base64.decodebytes(img_data)) - img = "ppeople/" + y + "/" + name - saveLocation = "ppeople/" + y + "/" + y + ".pickle" + img = People+"/" + y + "/" + name + saveLocation = People+"/" + y + "/" + y + ".pickle" ############ detecting no of faceses ####################### @@ -240,8 +241,9 @@ def submit(url_list): import cv2 from pathlib import Path - Path("GGallery/"+ India_Date).mkdir(exist_ok=True) - Path("GGallery/"+ India_Date +'/'+ input["FileName"]).mkdir(exist_ok=True) + Path(Gallery).mkdir(exist_ok=True) + Path(Gallery+"/"+ India_Date).mkdir(exist_ok=True) + Path(Gallery+"/"+ India_Date +'/'+ input["FileName"]).mkdir(exist_ok=True) a = input # print(a) @@ -264,11 +266,11 @@ def submit(url_list): import base64 - with open("GGallery/"+India_Date+'/' + input["FileName"] + "/" + name, "wb") as fh: + with open(Gallery+"/"+India_Date+'/' + input["FileName"] + "/" + name, "wb") as fh: fh.write(base64.decodebytes(img_data)) - path = "GGallery/" +India_Date+'/'+ y + "/" + name - pickle_location = "ppeople/" + y + "/" + y + ".pickle" + path = Gallery+"/" +India_Date+'/'+ y + "/" + name + pickle_location = People+"/" + y + "/" + y + ".pickle" import pathlib file = pathlib.Path(pickle_location) if file.exists (): @@ -278,7 +280,7 @@ def submit(url_list): print(name) return "Face not found in profile (please change your profile)" - check_faces="ppeople/" + y + "/" + y + ".jpg" + check_faces=People+"/" + y + "/" + y + ".jpg" print(check_faces)