Spaces:
Runtime error
Runtime error
shyamgupta196
commited on
Commit
•
2ba15e2
1
Parent(s):
41a89a9
app.py
CHANGED
@@ -3,7 +3,7 @@ from torch import nn
|
|
3 |
import numpy as np
|
4 |
import matplotlib.pyplot as plt
|
5 |
from palette import ade_palette
|
6 |
-
|
7 |
import gradio as gr
|
8 |
|
9 |
def seg(image):
|
@@ -36,7 +36,7 @@ def seg(image):
|
|
36 |
color_seg = color_seg[..., ::-1]
|
37 |
img = np.array(image) * 0.5 + color_seg * 0.5
|
38 |
img = img.astype(np.uint8)
|
39 |
-
|
40 |
return plt.imshow(img)
|
41 |
|
42 |
|
|
|
3 |
import numpy as np
|
4 |
import matplotlib.pyplot as plt
|
5 |
from palette import ade_palette
|
6 |
+
from PIL import Image
|
7 |
import gradio as gr
|
8 |
|
9 |
def seg(image):
|
|
|
36 |
color_seg = color_seg[..., ::-1]
|
37 |
img = np.array(image) * 0.5 + color_seg * 0.5
|
38 |
img = img.astype(np.uint8)
|
39 |
+
img = Image.fromarray(img)
|
40 |
return plt.imshow(img)
|
41 |
|
42 |
|