SameerR007
commited on
Commit
•
3a7d137
1
Parent(s):
23266b2
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import tensorflow as tf
|
2 |
+
model=tf.keras.models.load_model('model.h5')
|
3 |
+
import streamlit as st
|
4 |
+
st.header("Adidas VS Nike Classification")
|
5 |
+
categories=['Adidas','NIKE']
|
6 |
+
from PIL import Image
|
7 |
+
uploaded_image=st.file_uploader("Upload image",type=["jpg","jpeg","webp"])
|
8 |
+
import numpy as np
|
9 |
+
import cv2
|
10 |
+
if(uploaded_image!=None):
|
11 |
+
display_image=Image.open(uploaded_image)
|
12 |
+
st.image(display_image,width=200)
|
13 |
+
if st.button("Predict"):
|
14 |
+
img = np.array(display_image)
|
15 |
+
img=cv2.resize(img,(150,150))
|
16 |
+
img=img/255.0
|
17 |
+
img=img.reshape(1,150,150,3)
|
18 |
+
pred=model.predict(img)
|
19 |
+
print(pred[0][0])
|
20 |
+
st.text(categories[round(pred[0][0])])
|