File size: 798 Bytes
f0c612e
 
 
 
 
 
 
 
 
 
 
 
 
d67d24b
 
 
f0c612e
b67aed8
d67d24b
 
 
c12e131
f0c612e
 
 
3b9fc8c
 
f0c612e
 
 
 
 
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
from tensorflow.keras.models import load_model
from PIL import Image
import numpy as np 
import tensorflow as tf
import streamlit as st 

model = load_model('AgeClassifier.h5')
model2 = load_model('GenderClassifier.h5')
# Open the video file
f = st.file_uploader("Choose a Photo")
    # Read the video file from the file-like object
if f is not None:
    img = Image.open(f)

    img2 = img.resize((200,200))
    
    img = img.resize((256,256))
    img = np.reshape(img,(1,256,256,3))
    
    img2 = np.reshape(img2,(1,200,200,3))
    
    pred,pred2 = model.predict(img2),model2.predict(img)
    
    st.image(img,use_column_width=True)
    st.write(np.argmax(pred))
    st.write(pred)
    st.write(pred2)
    if pred2[0]>= 0.5:
        st.write('Male')
    else:
        st.write('Female')