|
import tensorflow as tf |
|
model=tf.keras.models.load_model('model.h5') |
|
import streamlit as st |
|
st.header("Adidas VS Nike Classification") |
|
categories=['Adidas','NIKE'] |
|
from PIL import Image |
|
uploaded_image=st.file_uploader("Upload image",type=["jpg","jpeg","webp"]) |
|
import numpy as np |
|
import cv2 |
|
if(uploaded_image!=None): |
|
display_image=Image.open(uploaded_image) |
|
st.image(display_image,width=200) |
|
if st.button("Predict"): |
|
img = np.array(display_image) |
|
img=cv2.resize(img,(150,150)) |
|
img=img/255.0 |
|
img=img.reshape(1,150,150,3) |
|
pred=model.predict(img) |
|
print(pred[0][0]) |
|
st.text(categories[round(pred[0][0])]) |
|
|