Spaces:
No application file
No application file
File size: 1,827 Bytes
c80d070 |
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
import joblib
import streamlit as st
from prediction import predict_single_image
knn_model = joblib.load('models/knn_model.joblib')
svm_model = joblib.load('models/svm_model.joblib')
random_forest_model = joblib.load('models/random_forest_model.joblib')
def show_error_popup(message):
st.error(message, icon="🚨")
st.set_page_config(layout="wide")
st.title('CASIA PALMPRINT DATASET')
st.markdown('By Yash Patel')
st.header('Add Palmprint Image')
uploaded_file = st.file_uploader("Choose an image", type=["jpg", "png", "jpeg"])
st.header("Available Models")
option = st.selectbox(
"Available Models",
("SVM", "KNN","Random Forest"),
)
predicted_label =""
col1, col2= st.columns(2)
if uploaded_file is not None:
with col1:
image_data = uploaded_file.read()
st.image(image_data, caption="Uploaded Image")
with col2:
if option=="SVM":
predicted_label = predict_single_image(svm_model,image_data)
elif option=="KNN":
predicted_label = predict_single_image(knn_model, image_data)
elif option=="Random Forest":
predicted_label = predict_single_image(random_forest_model, image_data)
else:
p = "Other Models are still under training due to overfitting"
print(predicted_label)
st.markdown("""
<style>
.big-font {
display: flex;
align-items:center;
justify-content: center;
font-size:50px !important;
color:green;
height: 50vh;
}
</style>
""", unsafe_allow_html=True)
st.markdown(f'<div class="big-font">{predicted_label}</div>', unsafe_allow_html=True)
else:
show_error_popup("Please Upload Image...")
|