AdithyaSNair commited on
Commit
471d63e
·
1 Parent(s): eef0cbd

Delete Dog Breed Prediction Streamlit App/main_app.py

Browse files
Dog Breed Prediction Streamlit App/main_app.py DELETED
@@ -1,42 +0,0 @@
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)]))