Update app.py
This commit is contained in:
		
							parent
							
								
									099fffbb6f
								
							
						
					
					
						commit
						1b33ce0832
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
					@ -19,8 +19,11 @@ def process_image():
 | 
				
			||||||
    request_data = json.loads(request.data.decode("utf-8"))
 | 
					    request_data = json.loads(request.data.decode("utf-8"))
 | 
				
			||||||
    img_nparr = np.frombuffer(base64.b64decode(request_data['image']), np.uint8)
 | 
					    img_nparr = np.frombuffer(base64.b64decode(request_data['image']), np.uint8)
 | 
				
			||||||
    img = cv2.imdecode(img_nparr,cv2.IMREAD_COLOR)
 | 
					    img = cv2.imdecode(img_nparr,cv2.IMREAD_COLOR)
 | 
				
			||||||
    racist_detector = DeepFace.analyze(img)
 | 
					    try:
 | 
				
			||||||
    return racist_detector
 | 
					        racist_detector = DeepFace.analyze(img)
 | 
				
			||||||
 | 
					        return racist_detector
 | 
				
			||||||
 | 
					    except:
 | 
				
			||||||
 | 
					        return []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if __name__ == '__main__':
 | 
					if __name__ == '__main__':
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue