M. Saad Munawar
commited on
Commit
•
5917c05
1
Parent(s):
0beda43
https://huggingface.co/spaces/Saad123/minimal
Browse files
app.py
CHANGED
@@ -1,13 +1,17 @@
|
|
1 |
import gradio as gr
|
2 |
import numpy as np
|
3 |
-
|
|
|
4 |
|
5 |
-
|
|
|
|
|
|
|
6 |
|
7 |
def model(image):
|
8 |
im_scaled = image/255
|
9 |
im_reshape = np.reshape(im_scaled,[1,224,224,3])
|
10 |
-
pred =
|
11 |
if (pred == 0):
|
12 |
return "The Image is of a Dog."
|
13 |
if (pred == 1):
|
|
|
1 |
import gradio as gr
|
2 |
import numpy as np
|
3 |
+
import tensorflow as tf
|
4 |
+
import tensorflow_hub as hub
|
5 |
|
6 |
+
loaded_model = tf.keras.models.load_model(
|
7 |
+
('CatDogmodel.h5'),
|
8 |
+
custom_objects={'KerasLayer':hub.KerasLayer}
|
9 |
+
)
|
10 |
|
11 |
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 |
if (pred == 0):
|
16 |
return "The Image is of a Dog."
|
17 |
if (pred == 1):
|