Spaces:
Sleeping
Sleeping
make service
Browse files
app.py
CHANGED
|
@@ -30,7 +30,7 @@ def makeOverlay(image, mask):
|
|
| 30 |
return overlay, colormap
|
| 31 |
|
| 32 |
|
| 33 |
-
def
|
| 34 |
with torch.no_grad():
|
| 35 |
image = image.resize((512, 512), Image.BILINEAR)
|
| 36 |
input_tensor = image_to_tensor(image)
|
|
@@ -41,7 +41,7 @@ def predict(image):
|
|
| 41 |
return output.squeeze(0).cpu().numpy().argmax(0)
|
| 42 |
|
| 43 |
|
| 44 |
-
def
|
| 45 |
mask = predict(image)
|
| 46 |
overlay, colormap = makeOverlay(image, mask)
|
| 47 |
return overlay
|
|
@@ -67,7 +67,7 @@ This demo is running on a CPU, if you like this project please make us a donatio
|
|
| 67 |
"""
|
| 68 |
|
| 69 |
demo = gr.Interface(
|
| 70 |
-
|
| 71 |
gr.Image(type="pil", label="Input"),
|
| 72 |
], [
|
| 73 |
gr.Image(type="numpy", label="Image face parsed")
|
|
|
|
| 30 |
return overlay, colormap
|
| 31 |
|
| 32 |
|
| 33 |
+
def makeMask(image):
|
| 34 |
with torch.no_grad():
|
| 35 |
image = image.resize((512, 512), Image.BILINEAR)
|
| 36 |
input_tensor = image_to_tensor(image)
|
|
|
|
| 41 |
return output.squeeze(0).cpu().numpy().argmax(0)
|
| 42 |
|
| 43 |
|
| 44 |
+
def predict(image):
|
| 45 |
mask = predict(image)
|
| 46 |
overlay, colormap = makeOverlay(image, mask)
|
| 47 |
return overlay
|
|
|
|
| 67 |
"""
|
| 68 |
|
| 69 |
demo = gr.Interface(
|
| 70 |
+
predict, [
|
| 71 |
gr.Image(type="pil", label="Input"),
|
| 72 |
], [
|
| 73 |
gr.Image(type="numpy", label="Image face parsed")
|