Upload files to 'Attendence'

This commit is contained in:
2023-09-04 07:22:17 +00:00
parent b31455f439
commit f1b1032b12
+14 -12
View File
@@ -8,7 +8,8 @@ import os
app = Flask(__name__) app = Flask(__name__)
#CORS(app) #CORS(app)
lst = [] lst = []
Gallery="Gallery"
People='People'
@app.route('/', methods=['GET']) @app.route('/', methods=['GET'])
def resume(): def resume():
@@ -40,8 +41,8 @@ def registered(url_list):
input=url_list input=url_list
from pathlib import Path from pathlib import Path
Path("ppeople").mkdir(exist_ok=True) Path(People).mkdir(exist_ok=True)
Path("ppeople/" + input["FileName"]).mkdir(exist_ok=True) Path(People+"/" + input["FileName"]).mkdir(exist_ok=True)
a = input a = input
# print(a) # print(a)
@@ -66,11 +67,11 @@ def registered(url_list):
import base64 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)) fh.write(base64.decodebytes(img_data))
img = "ppeople/" + y + "/" + name img = People+"/" + y + "/" + name
saveLocation = "ppeople/" + y + "/" + y + ".pickle" saveLocation = People+"/" + y + "/" + y + ".pickle"
############ detecting no of faceses ####################### ############ detecting no of faceses #######################
@@ -240,8 +241,9 @@ def submit(url_list):
import cv2 import cv2
from pathlib import Path from pathlib import Path
Path("GGallery/"+ India_Date).mkdir(exist_ok=True) Path(Gallery).mkdir(exist_ok=True)
Path("GGallery/"+ India_Date +'/'+ input["FileName"]).mkdir(exist_ok=True) Path(Gallery+"/"+ India_Date).mkdir(exist_ok=True)
Path(Gallery+"/"+ India_Date +'/'+ input["FileName"]).mkdir(exist_ok=True)
a = input a = input
# print(a) # print(a)
@@ -264,11 +266,11 @@ def submit(url_list):
import base64 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)) fh.write(base64.decodebytes(img_data))
path = "GGallery/" +India_Date+'/'+ y + "/" + name path = Gallery+"/" +India_Date+'/'+ y + "/" + name
pickle_location = "ppeople/" + y + "/" + y + ".pickle" pickle_location = People+"/" + y + "/" + y + ".pickle"
import pathlib import pathlib
file = pathlib.Path(pickle_location) file = pathlib.Path(pickle_location)
if file.exists (): if file.exists ():
@@ -278,7 +280,7 @@ def submit(url_list):
print(name) print(name)
return "Face not found in profile (please change your profile)" 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) print(check_faces)