N3tron commited on
Commit
8327a6e
·
verified ·
1 Parent(s): b27fd56

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -11
app.py CHANGED
@@ -1,10 +1,8 @@
1
- import streamlit as st
2
  import os
3
- import cv2
4
- import numpy as np
5
  import tempfile
6
  import zipfile
7
- import shutil
8
  import embeddings
9
 
10
  def extract_database(zip_file):
@@ -14,25 +12,25 @@ def extract_database(zip_file):
14
  zip_ref.extractall(temp_dir)
15
  return temp_dir
16
 
17
-
18
- #main function
19
  def main():
20
- st.title("FACE FUSE")
21
- tab_selection = st.sidebar.selectbox("Select Funtionality",["Embeddings","Immage Recognition","Video Recognition","Webcam Recognition"])
22
  if tab_selection == "Embeddings":
23
  st.header("Embeddings")
24
- zip_file = st.file_uploader("Upload DataBase(ZIP)",type="zip")
25
 
26
  if zip_file:
27
  db_dir = extract_database(zip_file)
28
  if st.button("Get Embeddings"):
29
- temp_dir=embeddings.get_embeddings(db_dir)
30
  embeddings_path = os.path.join(temp_dir, "embeddings.npy")
31
  names_path = os.path.join(temp_dir, "names.npy")
 
32
  st.write("Download numpy files:")
33
  st.download_button(label="Download embeddings.npy", data=open(embeddings_path, "rb"), file_name="embeddings.npy")
34
  st.download_button(label="Download names.npy", data=open(names_path, "rb"), file_name="names.npy")
 
35
  shutil.rmtree(db_dir, ignore_errors=True)
36
 
37
- if __name__=="__main__":
38
  main()
 
 
1
  import os
2
+ import shutil
3
+ import streamlit as st
4
  import tempfile
5
  import zipfile
 
6
  import embeddings
7
 
8
  def extract_database(zip_file):
 
12
  zip_ref.extractall(temp_dir)
13
  return temp_dir
14
 
 
 
15
  def main():
16
+ st.title("FACE ANALYZER")
17
+ tab_selection = st.sidebar.selectbox("Select Functionality", ["Embeddings", "Image Recognition", "Video Recognition", "Webcam Recognition"])
18
  if tab_selection == "Embeddings":
19
  st.header("Embeddings")
20
+ zip_file = st.file_uploader("Upload DataBase(ZIP)", type="zip")
21
 
22
  if zip_file:
23
  db_dir = extract_database(zip_file)
24
  if st.button("Get Embeddings"):
25
+ temp_dir = embeddings.get_embeddings(db_dir)
26
  embeddings_path = os.path.join(temp_dir, "embeddings.npy")
27
  names_path = os.path.join(temp_dir, "names.npy")
28
+
29
  st.write("Download numpy files:")
30
  st.download_button(label="Download embeddings.npy", data=open(embeddings_path, "rb"), file_name="embeddings.npy")
31
  st.download_button(label="Download names.npy", data=open(names_path, "rb"), file_name="names.npy")
32
+
33
  shutil.rmtree(db_dir, ignore_errors=True)
34
 
35
+ if __name__ == "__main__":
36
  main()