Pārlūkot izejas kodu

Upload files to 'Attendence'

SadhulaSaiKumar 1 gadu atpakaļ
vecāks
revīzija
f1b1032b12
1 mainītis faili ar 14 papildinājumiem un 12 dzēšanām
  1. 14
    12
      Attendence/uat_attendence.py

+ 14
- 12
Attendence/uat_attendence.py Parādīt failu

@@ -8,7 +8,8 @@ import os
8 8
 app = Flask(__name__)
9 9
 #CORS(app)
10 10
 lst = []
11
-
11
+Gallery="Gallery"
12
+People='People'
12 13
 
13 14
 @app.route('/', methods=['GET'])
14 15
 def resume():
@@ -40,8 +41,8 @@ def registered(url_list):
40 41
     input=url_list
41 42
 
42 43
     from pathlib import Path
43
-    Path("ppeople").mkdir(exist_ok=True)
44
-    Path("ppeople/" + input["FileName"]).mkdir(exist_ok=True)
44
+    Path(People).mkdir(exist_ok=True)
45
+    Path(People+"/" + input["FileName"]).mkdir(exist_ok=True)
45 46
 
46 47
     a = input
47 48
     # print(a)
@@ -66,11 +67,11 @@ def registered(url_list):
66 67
 
67 68
     import base64
68 69
 
69
-    with open("ppeople/" + input["FileName"] + "/" + name, "wb") as fh:
70
+    with open(People+"/" + input["FileName"] + "/" + name, "wb") as fh:
70 71
         fh.write(base64.decodebytes(img_data))
71 72
 
72
-    img = "ppeople/" + y + "/" + name
73
-    saveLocation = "ppeople/" + y + "/" + y + ".pickle"
73
+    img = People+"/" + y + "/" + name
74
+    saveLocation = People+"/" + y + "/" + y + ".pickle"
74 75
 
75 76
     ############ detecting no of faceses #######################
76 77
 
@@ -240,8 +241,9 @@ def submit(url_list):
240 241
     import cv2
241 242
 
242 243
     from pathlib import Path
243
-    Path("GGallery/"+ India_Date).mkdir(exist_ok=True)
244
-    Path("GGallery/"+ India_Date +'/'+ input["FileName"]).mkdir(exist_ok=True)
244
+    Path(Gallery).mkdir(exist_ok=True)
245
+    Path(Gallery+"/"+ India_Date).mkdir(exist_ok=True)
246
+    Path(Gallery+"/"+ India_Date +'/'+ input["FileName"]).mkdir(exist_ok=True)
245 247
 
246 248
     a = input
247 249
     # print(a)
@@ -264,11 +266,11 @@ def submit(url_list):
264 266
     import base64
265 267
     
266 268
 
267
-    with open("GGallery/"+India_Date+'/' + input["FileName"] + "/" + name, "wb") as fh:
269
+    with open(Gallery+"/"+India_Date+'/' + input["FileName"] + "/" + name, "wb") as fh:
268 270
         fh.write(base64.decodebytes(img_data))
269 271
 
270
-    path = "GGallery/" +India_Date+'/'+ y + "/" + name
271
-    pickle_location = "ppeople/" + y + "/" + y + ".pickle"
272
+    path = Gallery+"/" +India_Date+'/'+ y + "/" + name
273
+    pickle_location = People+"/" + y + "/" + y + ".pickle"
272 274
     import pathlib
273 275
     file = pathlib.Path(pickle_location)
274 276
     if file.exists ():
@@ -278,7 +280,7 @@ def submit(url_list):
278 280
         print(name)
279 281
         return "Face not found in profile (please change your profile)"
280 282
 
281
-    check_faces="ppeople/" + y + "/" + y + ".jpg"
283
+    check_faces=People+"/" + y + "/" + y + ".jpg"
282 284
     print(check_faces)
283 285
 
284 286
 

Notiek ielāde…
Atcelt
Saglabāt