Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,12 +10,12 @@ inputs = gr.inputs.Image()
|
|
| 10 |
output = gr.outputs.Image()
|
| 11 |
|
| 12 |
|
| 13 |
-
def predict(
|
| 14 |
img = np.array(inputs)
|
| 15 |
|
| 16 |
im = tf.image.resize(img, (128, 128))
|
| 17 |
im = tf.cast(im, tf.float32) / 255.0
|
| 18 |
-
pred_mask =
|
| 19 |
|
| 20 |
# take the best performing class for each pixel
|
| 21 |
# the output of argmax looks like this [[1, 2, 0], ...]
|
|
|
|
| 10 |
output = gr.outputs.Image()
|
| 11 |
|
| 12 |
|
| 13 |
+
def predict(inputs):
|
| 14 |
img = np.array(inputs)
|
| 15 |
|
| 16 |
im = tf.image.resize(img, (128, 128))
|
| 17 |
im = tf.cast(im, tf.float32) / 255.0
|
| 18 |
+
pred_mask = model.predict(im[tf.newaxis, ...])
|
| 19 |
|
| 20 |
# take the best performing class for each pixel
|
| 21 |
# the output of argmax looks like this [[1, 2, 0], ...]
|