Spaces:
Runtime error
Runtime error
Commit
·
96c7b81
1
Parent(s):
032022f
Upload 5 files
Browse files
Dog Breed Prediction Streamlit App/dog_breed.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f273c135f2e459467a2c21c3ed93384ba1492635add42e3cf8a41868f1b18b71
|
3 |
+
size 2019716
|
Dog Breed Prediction Streamlit App/main_app.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#Library imports
|
2 |
+
import numpy as np
|
3 |
+
import streamlit as st
|
4 |
+
import cv2
|
5 |
+
from keras.models import load_model
|
6 |
+
|
7 |
+
|
8 |
+
#Loading the Model
|
9 |
+
model = load_model('dog_breed.h5')
|
10 |
+
|
11 |
+
#Name of Classes
|
12 |
+
CLASS_NAMES = ['Scottish Deerhound','Maltese Dog','Bernese Mountain Dog']
|
13 |
+
|
14 |
+
#Setting Title of App
|
15 |
+
st.title("Dog Breed Prediction")
|
16 |
+
st.markdown("Upload an image of the dog")
|
17 |
+
|
18 |
+
#Uploading the dog image
|
19 |
+
dog_image = st.file_uploader("Choose an image...", type="png")
|
20 |
+
submit = st.button('Predict')
|
21 |
+
#On predict button click
|
22 |
+
if submit:
|
23 |
+
|
24 |
+
|
25 |
+
if dog_image is not None:
|
26 |
+
|
27 |
+
# Convert the file to an opencv image.
|
28 |
+
file_bytes = np.asarray(bytearray(dog_image.read()), dtype=np.uint8)
|
29 |
+
opencv_image = cv2.imdecode(file_bytes, 1)
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
# Displaying the image
|
34 |
+
st.image(opencv_image, channels="BGR")
|
35 |
+
#Resizing the image
|
36 |
+
opencv_image = cv2.resize(opencv_image, (224,224))
|
37 |
+
#Convert image to 4 Dimension
|
38 |
+
opencv_image.shape = (1,224,224,3)
|
39 |
+
#Make Prediction
|
40 |
+
Y_pred = model.predict(opencv_image)
|
41 |
+
|
42 |
+
st.title(str("The Dog Breed is "+CLASS_NAMES[np.argmax(Y_pred)]))
|
Dog Breed Prediction Streamlit App/requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Keras==2.4.3
|
2 |
+
opencv_python==4.4.0.46
|
3 |
+
numpy==1.18.5
|
4 |
+
streamlit==0.71.0
|
Dogbreed_Prediction.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|
Readme.md
ADDED
File without changes
|