Commit
·
1709591
1
Parent(s):
cb0a970
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import cv2
|
2 |
from fastai.vision.all import *
|
|
|
3 |
import gradio as gr
|
4 |
|
5 |
fnames = get_image_files("./albumentations/original")
|
@@ -27,7 +28,7 @@ def predict_segmentation(img):
|
|
27 |
# Convert the predicted mask to a color image
|
28 |
color_pred = pred[0].show(ctx=None, cmap='gray', alpha=None)
|
29 |
# Convert the color image to a numpy array
|
30 |
-
color_pred_array = np.
|
31 |
# Convert the numpy array back to a PIL image
|
32 |
output_image = Image.fromarray(color_pred_array)
|
33 |
return output_image
|
|
|
1 |
import cv2
|
2 |
from fastai.vision.all import *
|
3 |
+
import numpy as np
|
4 |
import gradio as gr
|
5 |
|
6 |
fnames = get_image_files("./albumentations/original")
|
|
|
28 |
# Convert the predicted mask to a color image
|
29 |
color_pred = pred[0].show(ctx=None, cmap='gray', alpha=None)
|
30 |
# Convert the color image to a numpy array
|
31 |
+
color_pred_array = color_pred_array.astype(np.uint8)
|
32 |
# Convert the numpy array back to a PIL image
|
33 |
output_image = Image.fromarray(color_pred_array)
|
34 |
return output_image
|