M. Saad Munawar
commited on
Commit
•
48133ea
1
Parent(s):
a088002
https://huggingface.co/spaces/Saad123/minimal
Browse files
app.py
CHANGED
@@ -12,11 +12,13 @@ def model(image):
|
|
12 |
im_scaled = image/255
|
13 |
im_reshape = np.reshape(im_scaled,[1,224,224,3])
|
14 |
pred = loaded_model.predict(im_reshape)
|
|
|
|
|
15 |
pred_label = np.argmax(pred)
|
16 |
if (pred_label == 0):
|
17 |
-
return "The Image is of a Dog
|
18 |
if (pred_label == 1):
|
19 |
-
return "The Image is of a Cat
|
20 |
|
21 |
image = gr.inputs.Image(shape=(224,224))
|
22 |
background='body{background-image:url("https://d2gg9evh47fn9z.cloudfront.net/800px_COLOURBOX35440124.jpg");}'
|
|
|
12 |
im_scaled = image/255
|
13 |
im_reshape = np.reshape(im_scaled,[1,224,224,3])
|
14 |
pred = loaded_model.predict(im_reshape)
|
15 |
+
cat_pred = pred
|
16 |
+
dog_pred = 1-pred
|
17 |
pred_label = np.argmax(pred)
|
18 |
if (pred_label == 0):
|
19 |
+
return f"The Image is of a Dog.\nProbability for Cat:{cat_pred}\tProbability for Dog:{dog_pred}"
|
20 |
if (pred_label == 1):
|
21 |
+
return "The Image is of a Cat.\nProbability for Cat:{cat_pred}\tProbability for Dog:{dog_pred}"
|
22 |
|
23 |
image = gr.inputs.Image(shape=(224,224))
|
24 |
background='body{background-image:url("https://d2gg9evh47fn9z.cloudfront.net/800px_COLOURBOX35440124.jpg");}'
|