Spaces:
Sleeping
Sleeping
Ahsen Khaliq
commited on
Commit
•
76bbdc4
1
Parent(s):
342c323
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,6 @@ model = hub.Module(name='U2Net')
|
|
14 |
def infer(img,mask,option):
|
15 |
img = ImageOps.contain(img, (700,700))
|
16 |
width, height = img.size
|
17 |
-
mask = mask.resize((width,height))
|
18 |
img.save("./data/data.png")
|
19 |
if option == "automatic (U2net)":
|
20 |
result = model.Segmentation(
|
@@ -26,6 +25,7 @@ def infer(img,mask,option):
|
|
26 |
visualization=True)
|
27 |
im = Image.fromarray(result[0]['mask'])
|
28 |
else:
|
|
|
29 |
im = mask
|
30 |
im.save("./data/data_mask.png")
|
31 |
os.system('python predict.py model.path=/home/user/app/big-lama/ indir=/home/user/app/data/ outdir=/home/user/app/dataout/ device=cpu')
|
|
|
14 |
def infer(img,mask,option):
|
15 |
img = ImageOps.contain(img, (700,700))
|
16 |
width, height = img.size
|
|
|
17 |
img.save("./data/data.png")
|
18 |
if option == "automatic (U2net)":
|
19 |
result = model.Segmentation(
|
|
|
25 |
visualization=True)
|
26 |
im = Image.fromarray(result[0]['mask'])
|
27 |
else:
|
28 |
+
mask = mask.resize((width,height))
|
29 |
im = mask
|
30 |
im.save("./data/data_mask.png")
|
31 |
os.system('python predict.py model.path=/home/user/app/big-lama/ indir=/home/user/app/data/ outdir=/home/user/app/dataout/ device=cpu')
|