Turing311 commited on
Commit
9d6818f
1 Parent(s): 71e9e2a
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -64,7 +64,7 @@ def compare_face(frame1, frame2):
64
  resized_h = 150
65
 
66
  face2 = face2.resize((int(resized_w), int(resized_h)))
67
-
68
  if face1 is not None and face2 is not None:
69
  new_image = Image.new('RGB',(face1.width + face2.width + 10, 150), (80,80,80))
70
 
@@ -81,10 +81,11 @@ def compare_face(frame1, frame2):
81
 
82
  new_image.paste(face2,(face2.width + 10, 0))
83
  faces = new_image.copy()
 
84
  except:
85
  pass
86
 
87
- return [r.json(), faces]
88
 
89
  with gr.Blocks() as demo:
90
  gr.Markdown(
@@ -94,16 +95,16 @@ with gr.Blocks() as demo:
94
  )
95
  with gr.Row():
96
  with gr.Column():
97
- compare_face_input1 = gr.Image(type='filepath', height=480)
98
  gr.Examples(['examples/1.jpg', 'examples/2.jpg'],
99
  inputs=compare_face_input1)
100
  compare_face_button = gr.Button("Compare Face")
101
  with gr.Column():
102
- compare_face_input2 = gr.Image(type='filepath', height=480)
103
  gr.Examples(['examples/3.jpg', 'examples/4.jpg'],
104
  inputs=compare_face_input2)
105
  with gr.Column():
106
- compare_face_output = gr.Image(type="pil", height=150)
107
  compare_result_output = gr.JSON(label='Result')
108
 
109
  compare_face_button.click(compare_face, inputs=[compare_face_input1, compare_face_input2], outputs=[compare_result_output, compare_face_output])
 
64
  resized_h = 150
65
 
66
  face2 = face2.resize((int(resized_w), int(resized_h)))
67
+ '''
68
  if face1 is not None and face2 is not None:
69
  new_image = Image.new('RGB',(face1.width + face2.width + 10, 150), (80,80,80))
70
 
 
81
 
82
  new_image.paste(face2,(face2.width + 10, 0))
83
  faces = new_image.copy()
84
+ '''
85
  except:
86
  pass
87
 
88
+ return [r.json(), [face1, face2]]
89
 
90
  with gr.Blocks() as demo:
91
  gr.Markdown(
 
95
  )
96
  with gr.Row():
97
  with gr.Column():
98
+ compare_face_input1 = gr.Image(label="Image1", type='filepath', height=480)
99
  gr.Examples(['examples/1.jpg', 'examples/2.jpg'],
100
  inputs=compare_face_input1)
101
  compare_face_button = gr.Button("Compare Face")
102
  with gr.Column():
103
+ compare_face_input2 = gr.Image(label="Image2", type='filepath', height=480)
104
  gr.Examples(['examples/3.jpg', 'examples/4.jpg'],
105
  inputs=compare_face_input2)
106
  with gr.Column():
107
+ compare_face_output = gr.Gallery(label="Faces", type="pil", height=150, columns=[2], rows=[1])
108
  compare_result_output = gr.JSON(label='Result')
109
 
110
  compare_face_button.click(compare_face, inputs=[compare_face_input1, compare_face_input2], outputs=[compare_result_output, compare_face_output])