Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,12 @@ labels = ['Dog', 'Cat']
|
|
11 |
def predict(img):
|
12 |
img = PILImage.create(img)
|
13 |
pred, pred_idx, probs = learn_inf.predict(img)
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
title = "Is this image of a cat?"
|
17 |
iface = gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512,512)), outputs=gr.outputs.Label(num_top_classes=2), title=title)
|
|
|
11 |
def predict(img):
|
12 |
img = PILImage.create(img)
|
13 |
pred, pred_idx, probs = learn_inf.predict(img)
|
14 |
+
|
15 |
+
# Check if the prediction is "Cat" and return the appropriate string
|
16 |
+
if pred == 'Cat':
|
17 |
+
return "This is a cat"
|
18 |
+
else:
|
19 |
+
return "This is not a cat"
|
20 |
|
21 |
title = "Is this image of a cat?"
|
22 |
iface = gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512,512)), outputs=gr.outputs.Label(num_top_classes=2), title=title)
|