priyankasharma5882 commited on
Commit
2e5a63e
1 Parent(s): b2df2c1

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import tensorflow as tf
2
+ import gradio as gr
3
+ import cv2
4
+ import numpy as np
5
+
6
+ new_model = tf.keras.models.load_model('breedclassification.h5')
7
+
8
+ def predict_classes(link):
9
+ img = cv2.resize(link,(224,224))
10
+ img = img/255
11
+ img = img.reshape(-1,224,224,3)
12
+ pred = np.round(new_model.predict(img)).argmax(axis = 1)
13
+ dic = {0: 'Herding breed', 1: 'Hound breed', 2: 'Non sporting breed', 3: 'Terrior breed', 4:'working breed', 5: 'sporting breed', 6: 'toy breed'}
14
+ print(dic.get(int(pred)))
15
+ a = dic.get(int(pred))
16
+ return a
17
+
18
+ label = gr.outputs.Label(num_top_classes=7)
19
+ gr.Interface(fn=predict_classes, inputs='image', outputs=label,interpretation='default', title = 'Breed Classification detection ', description = 'It will classify 7 different species: You can drage the images from google. 1. Terrier 2. Toy 3. Working 4. Sporting 5. Haund 6. Herding 7. Non sporting Group ').launch()