Commit
·
b2df2c1
1
Parent(s):
6ec021e
Delete application.py
Browse files- application.py +0 -19
application.py
DELETED
@@ -1,19 +0,0 @@
|
|
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. Hound 6. Herding 7. Non sporting Group ').launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|