Spaces:
Runtime error
Runtime error
OmerFarooq
commited on
Commit
•
8849d6d
1
Parent(s):
4c8eb7e
Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,13 @@ base_model = keras.applications.Xception(
|
|
14 |
|
15 |
base_model.trainable = False
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
#function for creating model
|
18 |
#returns model, its inputs, Xception's last conv output, the whole model's outputs
|
19 |
def create_model_mod():
|
@@ -95,6 +102,7 @@ weights = "weights.h5"
|
|
95 |
# img, y_pred = gen_grad_img_single(weights, img)
|
96 |
|
97 |
def get_grad(img):
|
|
|
98 |
a = gen_grad_img_single(weights, img)
|
99 |
return a
|
100 |
|
|
|
14 |
|
15 |
base_model.trainable = False
|
16 |
|
17 |
+
|
18 |
+
def img_pros(img):
|
19 |
+
img = tf.keras.preprocessing.image.img_to_array(img)
|
20 |
+
img = tf.image.resize(img, [160,160])
|
21 |
+
img = tf.expand_dims(img, axis = 0)
|
22 |
+
return img
|
23 |
+
|
24 |
#function for creating model
|
25 |
#returns model, its inputs, Xception's last conv output, the whole model's outputs
|
26 |
def create_model_mod():
|
|
|
102 |
# img, y_pred = gen_grad_img_single(weights, img)
|
103 |
|
104 |
def get_grad(img):
|
105 |
+
img = img_pros(img)
|
106 |
a = gen_grad_img_single(weights, img)
|
107 |
return a
|
108 |
|