Adithedev's picture
Rename deploy_app.py to app.py
a105a9f verified
import cv2
import time
import tempfile
import numpy as tf
import streamlit as st
import tensorflow as tf
from cv_func import predict
st.title("Gender Detectior using OpenCv and Tensorflow")
uploader = st.file_uploader(label="Upload the png here: ",type=["jpg","png"])
if uploader is None:
st.warning("⚠️| Hey there! Ready to unveil the mysteries? Upload an image and let's predict some genders!")
if uploader is not None:
print("log update: file uploaded!")
st.write("⏳ | Brace yourselves! Our top-notch AI detectives are on the case....")
time.sleep(3)
st.write("⏳ | Analyzing the pixels to uncover the hidden secrets of gender in your image.....")
time.sleep(3)
st.write("βŒ› | This could be the moment we crack the code or just end up with some hilariously unexpected results")
time.sleep(3)
st.write("βœ… | Done!")
with tempfile.NamedTemporaryFile(delete=False) as temp_file:
temp_file.write(uploader.read())
image_filename = temp_file.name
ans,men,women = predict(image_filename)
st.header("Output:")
col1, col2 = st.columns(2,)
with col1:
st.header("Men:")
st.metric("Count", men)
with col2:
st.header("Women:")
st.metric("Count", women)
st.image(ans)