Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,6 @@ import os
|
|
| 7 |
import numpy as np
|
| 8 |
|
| 9 |
|
| 10 |
-
# labels= {'Burger King': 0, 'KFC': 1,'McDonalds': 2,'Other': 3,'Starbucks': 4,'Subway': 5}
|
| 11 |
HEIGHT,WIDTH=224,224
|
| 12 |
IMG_SIZE=224
|
| 13 |
model=load_model('Models/best_model1.h5')
|
|
@@ -51,15 +50,21 @@ def classify_image(inp):
|
|
| 51 |
prediction = model.predict(inp).flatten()
|
| 52 |
return {labels[i]: f"{prediction[i]:.6f}" for i in range(NUM_CLASSES)}
|
| 53 |
|
| 54 |
-
# image = gr.inputs.Image(shape=(IMG_SIZE, IMG_SIZE))
|
| 55 |
-
# label = gr.outputs.Label(num_top_classes=2)
|
| 56 |
-
|
| 57 |
-
# gr.Interface(fn=classify_image, inputs=image, outputs=label, title='Cats Vs Dogs',height=600, width=1200,examples=ex,theme='peach').launch(debug=True)
|
| 58 |
-
|
| 59 |
-
|
| 60 |
image = gr.Image(height=HEIGHT,width=WIDTH,label='Input')
|
| 61 |
label = gr.Label(num_top_classes=2)
|
| 62 |
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
import numpy as np
|
| 8 |
|
| 9 |
|
|
|
|
| 10 |
HEIGHT,WIDTH=224,224
|
| 11 |
IMG_SIZE=224
|
| 12 |
model=load_model('Models/best_model1.h5')
|
|
|
|
| 50 |
prediction = model.predict(inp).flatten()
|
| 51 |
return {labels[i]: f"{prediction[i]:.6f}" for i in range(NUM_CLASSES)}
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
image = gr.Image(height=HEIGHT,width=WIDTH,label='Input')
|
| 54 |
label = gr.Label(num_top_classes=2)
|
| 55 |
|
| 56 |
+
examples = [
|
| 57 |
+
["Examples/img1.png"],
|
| 58 |
+
["Examples/img2.png"],
|
| 59 |
+
["Examples/img3.png"],
|
| 60 |
+
["Examples/img4.png"]
|
| 61 |
+
]
|
| 62 |
|
| 63 |
|
| 64 |
+
gr.Interface(
|
| 65 |
+
fn=classify_image,
|
| 66 |
+
inputs=image,
|
| 67 |
+
outputs=label,
|
| 68 |
+
title='Smart Pet Classifier',
|
| 69 |
+
examples=examples
|
| 70 |
+
).launch(debug=False)
|