Commit
·
c25a556
1
Parent(s):
5a36cdc
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import urllib.request
|
|
6 |
import numpy as np
|
7 |
import keras.backend as K
|
8 |
from transformers import pipeline
|
|
|
9 |
|
10 |
from PIL import Image
|
11 |
from matplotlib import cm
|
@@ -65,8 +66,14 @@ def gen_pred(img, model=seg_model):
|
|
65 |
img = tf.expand_dims(img, axis=0)
|
66 |
pred = model.predict(img)
|
67 |
pred = np.squeeze(pred, axis=0)
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
# return "UI in developing process ..."
|
69 |
-
return
|
70 |
|
71 |
title = "<h1 style='text-align: center;'>Semantic Segmentation</h1>"
|
72 |
description = "Upload an image and get prediction mask"
|
|
|
6 |
import numpy as np
|
7 |
import keras.backend as K
|
8 |
from transformers import pipeline
|
9 |
+
from matplotlib import pyplot as plt
|
10 |
|
11 |
from PIL import Image
|
12 |
from matplotlib import cm
|
|
|
66 |
img = tf.expand_dims(img, axis=0)
|
67 |
pred = model.predict(img)
|
68 |
pred = np.squeeze(pred, axis=0)
|
69 |
+
fig = plt.figure(figsize=(10, 7))
|
70 |
+
fig.add_subplot(rows, columns, 1)
|
71 |
+
plt.imshow(pred, interpolation='catrom')
|
72 |
+
plt.axis('off')
|
73 |
+
plt.title("Prediction")
|
74 |
+
plt.show()
|
75 |
# return "UI in developing process ..."
|
76 |
+
return fig
|
77 |
|
78 |
title = "<h1 style='text-align: center;'>Semantic Segmentation</h1>"
|
79 |
description = "Upload an image and get prediction mask"
|