sonobit commited on
Commit
024907e
·
1 Parent(s): 747cc08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import streamlit as st
 
2
  from PIL import Image
3
  from terran.io import open_image
4
  from terran.vis import display_image, vis_faces
@@ -7,7 +8,10 @@ from terran.face import face_detection
7
  file= st.file_uploader('Choose an image',type=['png','jpg'])
8
  if file is not None:
9
  st.write(file.name)
10
- #st.image(file)
 
 
 
11
  image = open_image(file.name)
12
  detections = face_detection(image)
13
  display_image(vis_faces(image, detections))
 
1
  import streamlit as st
2
+ from io import BytesIO
3
  from PIL import Image
4
  from terran.io import open_image
5
  from terran.vis import display_image, vis_faces
 
8
  file= st.file_uploader('Choose an image',type=['png','jpg'])
9
  if file is not None:
10
  st.write(file.name)
11
+ image = Image.open(ByteIO(file))
12
+ image = np.asarray(image.convert('RGB'))
13
+ if len(image.shape) == 2:
14
+ image = np.stack([image] * 3, axis=-1)
15
  image = open_image(file.name)
16
  detections = face_detection(image)
17
  display_image(vis_faces(image, detections))