justin2341 commited on
Commit
b2c192d
·
verified ·
1 Parent(s): ed8443d

Update demo.py

Browse files
Files changed (1) hide show
  1. demo.py +13 -13
demo.py CHANGED
@@ -30,19 +30,19 @@ def face_crop(image, face_rect):
30
  return face_image
31
 
32
  def compare_face(image1, image2):
33
- # try:
34
- # img_bytes1 = io.BytesIO()
35
- # image1.save(img_bytes1, format="JPEG")
36
- # img_bytes1.seek(0)
37
- # except:
38
- # return ["Failed to open image1", {"resultCode": "Failed to open image1"}]
39
-
40
- # try:
41
- # img_bytes2 = io.BytesIO()
42
- # image2.save(img_bytes2, format="JPEG")
43
- # img_bytes2.seek(0)
44
- # except:
45
- # return ["Failed to open image2", {"resultCode": "Failed to open image2"}]
46
 
47
  # url = "http://127.0.0.1:8080/compare_face"
48
  # files = {'file1': img_bytes1, 'file2': img_bytes2}
 
30
  return face_image
31
 
32
  def compare_face(image1, image2):
33
+ try:
34
+ img_bytes1 = io.BytesIO()
35
+ image1.save(img_bytes1, format="JPEG")
36
+ img_bytes1.seek(0)
37
+ except:
38
+ return "Failed to open image1"
39
+
40
+ try:
41
+ img_bytes2 = io.BytesIO()
42
+ image2.save(img_bytes2, format="JPEG")
43
+ img_bytes2.seek(0)
44
+ except:
45
+ return "Failed to open image2"
46
 
47
  # url = "http://127.0.0.1:8080/compare_face"
48
  # files = {'file1': img_bytes1, 'file2': img_bytes2}