-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
37 lines (29 loc) · 1.05 KB
/
main.py
File metadata and controls
37 lines (29 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import streamlit as st
from PIL import Image, ImageDraw
import os
# Run below cmd on Docker
# sudo docker run -e VISION-FACE=True -v localstorage:/datastore -p 80:5000 --name deepfacerecog deepquestai/deepstack
st.title("Train images")
img1 = st.file_uploader("Upload first face", type=["png", "jpg", "jpeg"])
img2 = st.file_uploader("Upload second face", type=["png", "jpg", "jpeg"])
username = st.text_input("Enter Person's Name")
btn = st.button("Upload")
if btn:
pil_image1 = Image.open(img1)
pil_image2 = Image.open(img2)
file_path1 = "images/"+username+"1"+".jpg"
pil_image1.save(file_path1)
file_path2 = "images/"+username+"2"+".jpg"
pil_image2.save(file_path2)
script = "python register.py "+file_path1+" "+file_path2+" "+username
print(script)
a = os.popen(script).readlines()
st.write(a)
st.title("Test new images")
test_img = st.file_uploader("Upload a new face", type=["png", "jpg", "jpeg"])
if test_img:
pil_test = Image.open(test_img)
pil_test.save("test.jpg")
a = os.popen("python test.py").readlines()
st.write(a)
st.image("face.jpg")