def mask_test(self): #print('entered') global check, cnt, count, flag, m_id img = self.vs.read() img = cv2.resize(img, (int(1000), int(700))) img = cv2.flip(img, 1) temperature123 = read_temp() #self.sl3.config(text="Show Your ID", fg='black', bg='#D5DBDB') # self.sl1.config(text="READY TO CHECK MASK.", fg='black', bg='#D5DBDB') while not temperature123: temperature123 = read_temp() img1 = cv2.imread('/home/pi/Desktop/face_new/114.jpg') img1 = cv2.resize(img1, (int(1000), int(700))) blended1 = cv2.addWeighted(src1=img, alpha=1, src2=img1, beta=0.9, gamma=0) # cv2.imshow('1',blended1) # cv2.waitKey(1) print(check) if (check == 0 or check == 1): if (temperature123 > float(temp)): self.sl2.config(text=str(temperature123) + " °F", fg='red', bg='#f09f10') else: self.sl2.config(text=str(temperature123) + " °F", fg='black', bg='#f09f10') # abs try: (locs, preds) = self.detect_and_predict_mask(blended1, faceNet, maskNet) print(preds) if (len(preds) > 0): for (box, pred) in zip(locs, preds): # unpack the bounding box and predictions (startX, startY, endX, endY) = box (mask, withoutMask) = pred # determine the class label and color we'll use to draw # the bounding box and text label = "Mask" if mask > withoutMask else "No Mask" print(label, check) # color = (0, 255, 0) if label == "Mask" else (0, 0, 255) if (label == "No Mask" and max(mask, withoutMask) * 100 > 50): # if(check==0): # subprocess.Popen("echo 'Please wear face mask' | festival --tts",shell=True) # # # subprocess.Popen("python3 audio.py --model 'Please wear face mask'",shell=True) # time.sleep(1) # self.sl1.config(text="Please Wear Face Mask", fg='Yellow', bg='#333579') count = 0 # elif(check==1): self.sl2.config(text="Temperature Scanning", fg='black', bg='#f09f10') self.sl3.config(text="Face Scanning...", fg='#FFFFFF', bg='#333579') check = 2 # audio_out('Please wear face mask') elif (label == "Mask" and max(mask, withoutMask) * 100 > 90 and check == 0): count += 1 print('entered', count) if (count > 2): # subprocess.Popen("python3 audio.py --model 'show your face for attendance'",shell=True) time.sleep(0.1) subprocess.Popen( "echo 'show your face for attendance' | festival --tts", shell=True) self.sl1.config(text="Mask OK", fg='#FFFFFF', bg='#333579') self.sl3.config(text="Show Your face", fg='#FFFFFF', bg='#333579') # audio_out('show your face for attendance') m_id = 1 check = 1 elif (check == 1): pass else: count = 0 self.sl3.config(text="", fg='BLACK', bg='#333579') self.sl1.config(text="SCANNING MASK...", fg='#FFFFFF', bg='#333579') elif (not (len(preds) > 0 or check == 1)): self.sl3.config(text="", fg='BLACK', bg='#333579') self.sl1.config(text="SCANNING MASK...", fg='#FFFFFF', bg='#333579') except: self.sl3.config(text="", fg='BLACK', bg='#333579') self.sl1.config(text="SCANNING MASK...", fg='#FFFFFF', bg='#333579') elif (check == 2): print('entered face') self.sl2.config(text="Temperature Scanning", fg='black', bg='#f09f10') self.sl3.config(text="Face Scanning...", fg='#FFFFFF', bg='#333579') name = face.recognize(data, blended1) # cv2.imwrite(str(time.localtime()[5])+".jpg",blended1) print(name) if (name == 'None'): flag += 1 if (flag == 35): check = 3 else: # print('excibit') now = time.localtime() temp_list = [ now[0], now[1], now[2], now[3], now[4], now[5], str(temperature123) ] print(now) if (len(str(now[1])) < 2): temp_list[1] = '0' + str(now[1]) if (len(str(now[2])) < 2): temp_list[2] = '0' + str(now[2]) if (len(str(now[3])) < 2): temp_list[3] = '0' + str(now[3]) if (len(str(now[4])) < 2): temp_list[4] = '0' + str(now[4]) if (len(str(now[5])) < 2): temp_list[5] = '0' + str(now[5]) print(len(str(temperature123))) k = 1 try: k = 0 if (name != "Unknown"): r_name = name if (len(name) < 8): pri = '0' * (8 - len(name)) r_name = pri + name time_stamp = str(temp_list[3]) + str( temp_list[4]) + str(temp_list[5]) date_stamp = str(temp_list[2]) + str( temp_list[1]) + str(temp_list[0]) detail = "'" + reader_name + time_stamp + date_stamp + str( r_name) + "00000'" conn1 = sqlite3.connect('attendance.db') c1 = conn1.cursor() c1.execute( "INSERT INTO temp_attendance (Detail, temperature, Mask) VALUES (%s,%s,%s)" % (detail, temp_list[6], str(m_id))) print('inserted') # Save (commit) the changes conn1.commit() conn1.close() self.sl1.config(text=" ", fg='#FFFFFF', bg='#333579') if (temperature123 > float(temp)): GPIO.output(R_LED, 1) GPIO.output(BUZZER, 1) time.sleep(2) GPIO.output(BUZZER, 0) self.sl2.config(text=str(temperature123) + " °F", fg='RED', bg='#f09f10') subprocess.Popen( "echo 'Temperature Abnormal' | festival --tts", shell=True) # audio_out('High Temperature Detected') # subprocess.Popen("python3 audio.py --model 'High Temperature Detected Not Allowed'",shell=True) self.sl3.config(text="EMP ID : " + name, fg='#ffffff', bg='#333579') # self.test_data=udplib.Attend_send(name+"~"+str(temperature123),host_ip=host_ip,port_no=port_no,bufferSize = 1024) time.sleep(0.1) # try: # self.test_datas=self.test_data.split('~') # self.sl4.config(text="EMP Name : "+self.test_datas[1], fg='#ffffff', bg='#333579') # except: # self.sl4.config(text=" ", fg='#ffffff', bg='#333579') self.sl1.config(text="Not Allowed", fg='RED', bg='#333579') #audio_out('Not Allowed') else: GPIO.output(G_LED, 1) self.sl2.config(text=str(temperature123) + " °F", fg='BLACK', bg='#f09f10') self.sl3.config(text="EMP ID : " + name, fg='#ffffff', bg='#333579') time.sleep(0.1) subprocess.Popen( "echo 'Attendance Marked Successfully' | festival --tts", shell=True) else: self.sl3.config(text="EMP ID : " + name, fg='#ffffff', bg='#333579') except: self.sl1.config(text="Server Connection Error", fg='RED', bg='#333579') # self.sl1.config(text="Server Connection Error", fg='RED', bg='#333579') #self.depositLabel["text"] = "Server Connection Error" # self.test_data="~~~~~" #self.sl1.config(text="READY TO CHECK MASK.", fg='black', bg='#D5DBDB') check = 3 elif (check == 3): cnt += 1 if (cnt == 5): flag = 0 m_id = 0 GPIO.output(BUZZER, 0) GPIO.output(G_LED, 0) GPIO.output(R_LED, 0) check = 0 cnt = 1 count = 0 self.sl4.config(text="", fg='#FFFFFF', bg='#333579') self.sl3.config(text="", fg='#FFFFFF', bg='#333579') self.sl1.config(text="SCANNING MASK...", fg='#FFFFFF', bg='#333579') self.sl2.config(text="", fg='#FFFFFF', bg='#333579') self.sl2.after(1000, self.mask_test)
def mask_test(self): global check, cnt img = self.vs.read() img = cv2.resize(img, (int(ws), int(hs / 1.2))) img = cv2.flip(img, 1) temperature123 = read_temp() #self.sl3.config(text="Show Your ID", fg='black', bg='#D5DBDB') # self.sl1.config(text="READY TO CHECK MASK.", fg='black', bg='#D5DBDB') while not temperature123: temperature123 = read_temp() # if(temperature123>100): # self.sl2.config(text="Temperature="+str(temperature123)+" °F", fg='black', bg='red') # else: # self.sl2.config(text="Temperature="+str(temperature123)+" °F", fg='black', bg='#D5DBDB') # blended1 = cv2.addWeighted(src1=img, alpha=1, src2=img1, beta=0.9, gamma=0) # cv2.imshow('1',blended1) # cv2.waitKey(1) if (check == 0): (locs, preds) = self.detect_and_predict_mask(blended1, faceNet, maskNet) #print(preds) if (len(preds) > 0): for (box, pred) in zip(locs, preds): # unpack the bounding box and predictions (startX, startY, endX, endY) = box (mask, withoutMask) = pred # determine the class label and color we'll use to draw # the bounding box and text label = "Mask" if mask > withoutMask else "No Mask" print(label, check) # color = (0, 255, 0) if label == "Mask" else (0, 0, 255) if (label == "No Mask" and check == 0): self.sl1.config(text="Please Wear Face Mask", fg='#FFFFFF', bg='RED') else: # print('entered') self.sl1.config(text="Mask OK", fg='#FFFFFF', bg='GREEN') check = 1 else: self.sl3.config(text=" ", fg='black', bg='#D5DBDB') self.sl1.config(text="SCANING MASK...", fg='black', bg='#D5DBDB') self.sl2.config(text=" ", fg='black', bg='#D5DBDB') elif (check == 1): print('entered') self.sl2.config(text="Temperature Scanning", fg='#FFFFFF', bg='#D5DBDB') self.sl3.config(text="Face Scanning...", fg='#FFFFFF', bg='#D5DBDB') name = face.recognize(data, blended1) print(name) if (name == 'None'): pass else: print('excibit') try: if (temperature123 > 100): self.sl2.config(text="Temperature=" + str(temperature123) + " °F", fg='black', bg='red') else: self.sl2.config(text="Temperature=" + str(temperature123) + " °F", fg='#FFFFFF', bg='green') self.sl1.config(text="Attendance Marked", fg='#FFFFFF', bg='GREEN') self.sl3.config(text="Your ID=" + name, fg='#ffffff', bg='green') except: self.depositLabel["text"] = "Server Connection Error" self.test_data = "~~~~~" #self.sl1.config(text="READY TO CHECK MASK.", fg='black', bg='#D5DBDB') check = 2 elif (check == 2): cnt += 1 if (cnt == 5): check = 0 cnt = 1 self.sl3.config(text=" ", fg='black', bg='#D5DBDB') self.sl1.config(text="SCANING MASK...", fg='black', bg='#D5DBDB') self.sl2.config(text=" ", fg='black', bg='#D5DBDB') self.sl2.after(1000, self.mask_test)
def mask_test(self): print('entered') global check,cnt,count,flag,m_id ret_val, img=self.vs.read() img = cv2.rotate(img, cv2.ROTATE_180) ## print(img) img=cv2.resize(img, (int(1000), int(700))) img = cv2.flip(img, 1) temperature123=0 #self.sl3.config(text="Show Your ID", fg='black', bg='#D5DBDB') # self.sl1.config(text="READY TO CHECK MASK.", fg='black', bg='#D5DBDB') while not temperature123: try: temperature123=read_temp() except: temperature123=0 img1 = cv2.imread('114.jpg' ) img1=cv2.resize(img1, (int(1000), int(700))) blended1 = cv2.addWeighted(src1=img,alpha=1,src2=img1,beta=0.9, gamma = 0) # cv2.imshow('1',blended1) # cv2.waitKey(1) print( check) if(check==0 or check==1): if(temperature123>float(temp)): self.sl2.config(text=str(temperature123)+" °F", fg='red', bg='#f09f10') else: self.sl2.config(text=str(temperature123)+" °F", fg='black', bg='#f09f10') # abs o=1 try: o=0 (locs, preds) = self.detect_and_predict_mask(blended1, faceNet, maskNet) print(preds) if(len(preds)>0): for (box, pred) in zip(locs, preds): # unpack the bounding box and predictions (startX, startY, endX, endY) = box (mask, withoutMask) = pred # determine the class label and color we'll use to draw # the bounding box and text label = "Mask" if mask > withoutMask else "No Mask" print(label,check) # color = (0, 255, 0) if label == "Mask" else (0, 0, 255) if(label == "No Mask" and max(mask, withoutMask) * 100>70): # if(check==0): # subprocess.Popen("echo 'Please wear face mask' | festival --tts",shell=True) # # # subprocess.Popen("python3 audio.py --model 'Please wear face mask'",shell=True) # time.sleep(1) # self.sl1.config(text="Please Wear Face Mask", fg='Yellow', bg='#333579') count=0 # elif(check==1): self.sl2.config(text="Temperature Scanning", fg='black', bg='#f09f10') self.sl3.config(text="Face Scanning...", fg='#FFFFFF', bg='#333579') check=2 # audio_out('Please wear face mask') elif(label == "Mask" and max(mask, withoutMask) * 100>70 and check== 0): count+=1 print('entered',count) if(count>=1): # subprocess.Popen("python3 audio.py --model 'Kindly Remove Mask for attendance'",shell=True) time.sleep(0.1) subprocess.Popen("echo 'Kindly Remove Mask for attendance' | festival --tts",shell=True) self.sl1.config(text="Mask OK", fg='#FFFFFF', bg='#333579') self.sl3.config(text="Kindly Remove Mask", fg='#FFFFFF', bg='#333579') # audio_out('Kindly Remove Mask for attendance') m_id=1 check=1 elif(check==1): pass else: count=0 self.sl3.config(text="", fg='BLACK', bg='#333579') self.sl1.config(text="SCANNING MASK...", fg='#FFFFFF', bg='#333579') elif(not(len(preds)>0 or check==1)): self.sl3.config(text="", fg='BLACK', bg='#333579') self.sl1.config(text="SCANNING MASK...", fg='#FFFFFF', bg='#333579') elif(not(len(preds)>0 and check==1)): print(flag) flag+=1 if(flag==10): check=3 except: self.sl3.config(text="", fg='BLACK', bg='#333579') self.sl1.config(text="SCANNING MASK...", fg='#FFFFFF', bg='#333579') elif(check==2): print('entered face') self.sl2.config(text="Temperature Scanning", fg='black', bg='#f09f10') self.sl3.config(text="Face Scanning...", fg='#FFFFFF', bg='#333579') name=face.recognize(data,blended1) # cv2.imwrite(str(time.localtime()[5])+".jpg",blended1) print(name) if(name=='None'): flag+=1 ## print('flag=',flag) if(flag==5): check=3 elif(name=="Unknown"): self.sl3.config(text="EMP ID : "+name, fg='#ffffff', bg='#333579') self.sl1.config(text="Not Allowed", bg='RED', fg='#ffffff') check=3 else: # print('excibit') k=1 while k: k=0 now = datetime.now() # current date and time c_time = now.strftime("%d-%m-%Y %H:%M:%S") print(c_time) conn1 = sqlite3.connect('attendance.db') c1 = conn1.cursor() c1.execute("INSERT INTO temp_attendance (Detail,Device_name ,Date , temperature, Mask) VALUES (%s,%s,%s,%s,%s)"% ("'"+name+"'","'A001'","'"+str(c_time)+"'","'"+str(temperature123)+"'",str(m_id))) print('inserted') # Save (commit) the changes conn1.commit() conn1.close() self.sl1.config(text=" ", fg='#FFFFFF', bg='#333579') if(temperature123>float(temp)): GPIO.output(R_LED,1) GPIO.output(BUZZER,1) self.sl2.config(text=str(temperature123)+" °F", fg='RED', bg='#f09f10') # audio_out('High Temperature Detected') # subprocess.Popen("python3 audio.py --model 'High Temperature Detected Not Allowed'",shell=True) self.sl3.config(text="EMP ID : "+name, fg='#ffffff', bg='#333579') # self.test_data=udplib.Attend_send(name+"~"+str(temperature123),host_ip=host_ip,port_no=port_no,bufferSize = 1024) ## time.sleep(0.1) # try: # self.test_datas=self.test_data.split('~') # self.sl4.config(text="EMP Name : "+self.test_datas[1], fg='#ffffff', bg='#333579') # except: # self.sl4.config(text=" ", fg='#ffffff', bg='#333579') self.sl1.config(text="Not Allowed", bg='RED', fg='#ffffff') subprocess.Popen("echo 'Temperature Abnormal' | festival --tts",shell=True) time.sleep(2) GPIO.output(BUZZER,0) #audio_out('Not Allowed') else: GPIO.output(G_LED,1) self.sl2.config(text=str(temperature123)+" °F", fg='BLACK', bg='#f09f10') self.sl1.config(text="Attendance Marked", bg='GREEN', fg='#ffffff') self.sl3.config(text="EMP ID : "+name, fg='#ffffff', bg='#333579') time.sleep(0.1) subprocess.Popen("echo 'Attendance Marked Successfully' | festival --tts",shell=True) ## except: ## self.sl1.config(text="Server Connection Error", fg='RED', bg='#333579') # self.sl1.config(text="Server Connection Error", fg='RED', bg='#333579') #self.depositLabel["text"] = "Server Connection Error" # self.test_data="~~~~~" #self.sl1.config(text="READY TO CHECK MASK.", fg='black', bg='#D5DBDB') check=3 elif(check==3): cnt+=1 if(cnt==5): flag=0 m_id=0 GPIO.output(BUZZER,0) GPIO.output(G_LED,0) GPIO.output(R_LED,0) check=0 cnt=1 count=0 self.sl4.config(text="", fg='#FFFFFF', bg='#333579') self.sl3.config(text="", fg='#FFFFFF', bg='#333579') self.sl1.config(text="SCANNING MASK...", fg='#FFFFFF', bg='#333579') self.sl2.config(text="", fg='#FFFFFF', bg='#333579') self.sl2.after(500, self.mask_test)
def barcode_read(self, event): global flag self.depositLabel["text"] = ' Your ID ' self.b_id = self.depositEntry.get() # print(self.b_id) location = os.getcwd() + "/dataset/" + str(self.b_id) imagePaths = list(paths.list_images(location)) # z=1 # while z: # z=0 try: for (i, imagePath) in enumerate(imagePaths): print(imagePath) print(imagePath) image = Image.open(imagePath) image = image.resize((250, 250), Image.ANTIALIAS) frame_image = ImageTk.PhotoImage(image) self.employee_img.config(image=frame_image) self.employee_img.image = frame_image z = 1 while z: z = 0 img = self.vs.read() img = cv2.resize(img, (int(1000), int(700))) img = cv2.flip(img, 1) temperature123 = read_temp() #self.sl3.config(text="Show Your ID", fg='black', bg='#D5DBDB') # self.sl1.config(text="READY TO CHECK MASK.", fg='black', bg='#D5DBDB') while not temperature123: temperature123 = read_temp() img1 = cv2.imread('/home/pi/Desktop/face_new/114.jpg') img1 = cv2.resize(img1, (int(1000), int(700))) blended1 = cv2.addWeighted(src1=img, alpha=1, src2=img1, beta=0.9, gamma=0) mask = self.detect_and_predict_mask(blended1, faceNet, maskNet) print(mask) if (mask == "No Mask"): state = 1 if (flag == 1): self.sl3.config(text="Mask Not Wear", fg='#000000', bg='RED') else: flag = 1 if (temperature123 > float(temp)): GPIO.output(R_LED, 1) GPIO.output(BUZZER, 1) time.sleep(2) GPIO.output(BUZZER, 0) self.sl1.config(text=str(temperature123) + " °F", fg='#000000', bg='RED') else: self.sl1.config(text=str(temperature123) + " °F", fg='#FFFFFF', bg='GREEN') for i in range(1): name = None while name == None: img = self.vs.read() img = cv2.resize(img, (int(1000), int(700))) img = cv2.flip(img, 1) blended1 = cv2.addWeighted(src1=img, alpha=1, src2=img1, beta=0.9, gamma=0) name = face.recognize(data, blended1) print('name=', name) if (name == self.b_id): self.test_data = udplib.Attend_send( self.b_id + "~" + str(temperature123), host_ip=host_ip, port_no=port_no, bufferSize=1024) GPIO.output(G_LED, 1) self.sl2.config(text="Face Matched", fg='#FFFFFF', bg='GREEN') else: GPIO.output(R_LED, 1) self.sl2.config(text="Face Not Matched", fg='#000000', bg='RED') elif (mask == "No Face"): state = 0 else: state = 0 flag = 0 self.sl2.config(text="Show Your Face", fg='#FFFFFF', bg='#333579') self.sl3.config(text="Mask OK", fg='#FFFFFF', bg='GREEN') except: state = 1 imagePath = "100.jpg" image = Image.open(imagePath) image = image.resize((250, 250), Image.ANTIALIAS) frame_image = ImageTk.PhotoImage(image) self.employee_img.config(image=frame_image) self.employee_img.image = frame_image self.sl2.config(text="Not in Emp list", fg='#000000', bg='RED') self.sl2.after(3000, lambda: self.reset(state))
def mask_test(self): #print('entered') global check,cnt,count,flag img=self.vs.read() img=cv2.resize(img, (int(1000), int(700))) img = cv2.flip(img, 1) temperature123=read_temp() #self.sl3.config(text="Show Your ID", fg='black', bg='#D5DBDB') # self.sl1.config(text="READY TO CHECK MASK.", fg='black', bg='#D5DBDB') while not temperature123: temperature123=read_temp() img1 = cv2.imread('114.jpg' ) img1=cv2.resize(img1, (int(1000), int(700))) blended1 = cv2.addWeighted(src1=img,alpha=1,src2=img1,beta=0.9, gamma = 0) # cv2.imshow('1',blended1) # cv2.waitKey(1) if(check==0 or check==1): if(temperature123>float(temp)): self.sl2.config(text=str(temperature123)+" °F", fg='red', bg='#f09f10') else: self.sl2.config(text=str(temperature123)+" °F", fg='black', bg='#f09f10') # abs try: (locs, preds) = self.detect_and_predict_mask(blended1, faceNet, maskNet) print(preds) if(len(preds)>0): for (box, pred) in zip(locs, preds): # unpack the bounding box and predictions (startX, startY, endX, endY) = box (mask, withoutMask) = pred # determine the class label and color we'll use to draw # the bounding box and text label = "Mask" if mask > withoutMask else "No Mask" print(label,check) # color = (0, 255, 0) if label == "Mask" else (0, 0, 255) if(label == "No Mask" and max(mask, withoutMask) * 100>50): if(check==0): subprocess.Popen("echo 'Please wear face mask' | festival --tts",shell=True) # subprocess.Popen("python3 audio.py --model 'Please wear face mask'",shell=True) time.sleep(1) self.sl1.config(text="Please Wear Face Mask", fg='Yellow', bg='#333579') elif(check==1): self.sl2.config(text="Temperature Scanning", fg='black', bg='#f09f10') self.sl3.config(text="Face Scanning...", fg='#FFFFFF', bg='#333579') check=2 count=0 # audio_out('Please wear face mask') elif(label == "Mask" and max(mask, withoutMask) * 100>80 and check== 0): count+=1 print('entered',count) if(count>1): # subprocess.Popen("python3 audio.py --model 'show your face for attendance'",shell=True) time.sleep(0.1) subprocess.Popen("echo 'show your face for attendance' | festival --tts",shell=True) self.sl1.config(text="Mask OK", fg='#FFFFFF', bg='#333579') self.sl3.config(text="Show Your face", fg='#FFFFFF', bg='#333579') # audio_out('show your face for attendance') check=1 elif(check==1): pass else: count=0 self.sl3.config(text="", fg='BLACK', bg='#333579') self.sl1.config(text="SCANNING MASK...", fg='#FFFFFF', bg='#333579') elif(not(len(preds)>0 or check==1)): count=0 self.sl3.config(text="", fg='BLACK', bg='#333579') self.sl1.config(text="SCANNING MASK...", fg='#FFFFFF', bg='#333579') except: self.sl3.config(text="", fg='BLACK', bg='#333579') self.sl1.config(text="SCANNING MASK...", fg='#FFFFFF', bg='#333579') elif(check==2): print('entered face') self.sl2.config(text="Temperature Scanning", fg='black', bg='#f09f10') self.sl3.config(text="Face Scanning...", fg='#FFFFFF', bg='#333579') name=face.recognize(data,blended1) # cv2.imwrite(str(time.localtime()[5])+".jpg",blended1) print(name) if(name=='None'): flag+=1 if(flag==35): check=3 else: # print('excibit') try: if(temperature123>float(temp)): GPIO.output(R_LED,1) GPIO.output(BUZZER,1) time.sleep(2) GPIO.output(BUZZER,0) self.sl2.config(text=str(temperature123)+" °F", fg='RED', bg='#f09f10') subprocess.Popen("echo 'Temperature Abnormal' | festival --tts",shell=True) # audio_out('High Temperature Detected') # subprocess.Popen("python3 audio.py --model 'High Temperature Detected Not Allowed'",shell=True) self.sl3.config(text="EMP ID : "+name, fg='#ffffff', bg='#333579') self.test_data=udplib.Attend_send(name+"~"+str(temperature123),host_ip=host_ip,port_no=port_no,bufferSize = 1024) time.sleep(0.1) try: self.test_datas=self.test_data.split('~') self.sl4.config(text="EMP Name : "+self.test_datas[1], fg='#ffffff', bg='#333579') except: self.sl4.config(text=" ", fg='#ffffff', bg='#333579') self.sl1.config(text="Not Allowed", fg='RED', bg='#333579') #audio_out('Not Allowed') else: GPIO.output(G_LED,1) self.sl2.config(text=str(temperature123)+" °F", fg='BLACK', bg='#f09f10') self.sl3.config(text="EMP ID : "+name, fg='#ffffff', bg='#333579') self.test_data=udplib.Attend_send(name+"~"+str(temperature123),host_ip=host_ip,port_no=port_no,bufferSize = 1024) try: self.test_datas=self.test_data.split('~') self.sl4.config(text="EMP Name : "+self.test_datas[1], fg='#ffffff', bg='#333579') self.sl1.config(text="Attendance Marked", fg='GREEN', bg='#333579') subprocess.Popen("echo 'Attendance Marked Successfully' | festival --tts",shell=True) # subprocess.Popen("python3 audio.py --model 'Attendance Marked Successfully'",shell=True) except: self.sl1.config(text="Empty data detected", fg='RED', bg='#333579') self.sl4.config(text=" ", fg='#ffffff', bg='#333579') time.sleep(1) # audio_out('Attendance Marked Successfully') except: self.sl1.config(text="Server Connection Error", fg='RED', bg='#333579') # self.sl1.config(text="Server Connection Error", fg='RED', bg='#333579') #self.depositLabel["text"] = "Server Connection Error" self.test_data="~~~~~" #self.sl1.config(text="READY TO CHECK MASK.", fg='black', bg='#D5DBDB') check=3 elif(check==3): cnt+=1 if(cnt==5): flag=0 GPIO.output(BUZZER,0) GPIO.output(G_LED,0) GPIO.output(R_LED,0) check=0 cnt=1 count=0 self.sl4.config(text="", fg='#FFFFFF', bg='#333579') self.sl3.config(text="", fg='#FFFFFF', bg='#333579') self.sl1.config(text="SCANNING MASK...", fg='#FFFFFF', bg='#333579') self.sl2.config(text="", fg='#FFFFFF', bg='#333579') self.sl2.after(1000, self.mask_test)