conciomith commited on
Commit
f4d2bbb
·
1 Parent(s): 2d50172

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -1,9 +1,23 @@
1
  import gradio as gr
2
  import RetinaFace
 
3
 
4
  def RFace(img):
5
  faces = RetinaFace.extract_faces(img, align = True)
6
- return faces[0]
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
 
9
 
 
1
  import gradio as gr
2
  import RetinaFace
3
+ import numpy as np
4
 
5
  def RFace(img):
6
  faces = RetinaFace.extract_faces(img, align = True)
7
+ last = np.zeros((20,20), np.uint8)
8
+ for count, image in enumerate(faces):
9
+ if count == 1:
10
+ last = image
11
+ else:
12
+ h1, w1 = last.shape[:2]
13
+ h2, w2 = image.shape[:2]
14
+ #create empty matrix
15
+ vis = np.zeros((max(h1, h2), w1+w2,3), np.uint8)
16
+ #combine 2 images
17
+ vis[:h1, :w1,:3] = last
18
+ vis[:h2, w1:w1+w2,:3] = image
19
+ last = vis
20
+ return last
21
 
22
 
23