Beasto commited on
Commit
f0c612e
·
1 Parent(s): 18414e6

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from tensorflow.keras.models import load_model
2
+ from PIL import Image
3
+ import numpy as np
4
+ import tensorflow as tf
5
+ import streamlit as st
6
+
7
+ model = load_model('AgeClassifier.h5')
8
+ model2 = load_model('GenderClassifier.h5')
9
+ # Open the video file
10
+ f = st.file_uploader("Choose a Photo")
11
+ # Read the video file from the file-like object
12
+ if f is not None:
13
+ img = Image.open(f)
14
+ img = img.resize((256,256))
15
+ img = np.reshape(img,(1,28,28,3))
16
+ pred,pred2 = model.predict(img),model2.predict(img)
17
+
18
+ st.image(img,use_column_width=True)
19
+ st.write(np.argmax(pred))
20
+ if pred2[0]>= 0.5:
21
+ st.write('Male')
22
+ else:
23
+ st.write('Female')
24
+