Spaces:
Runtime error
Runtime error
Ahsen Khaliq
commited on
Commit
•
7909c4f
1
Parent(s):
1d090f4
Update app.py
Browse files
app.py
CHANGED
@@ -15,6 +15,7 @@ torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2016/10/21/14/46/f
|
|
15 |
model = hub.Module(name='U2Net')
|
16 |
def infer(img):
|
17 |
img.save("./data/data.png")
|
|
|
18 |
result = model.Segmentation(
|
19 |
images=[cv2.cvtColor(np.array(img), cv2.COLOR_RGB2BGR)],
|
20 |
paths=None,
|
@@ -24,7 +25,9 @@ def infer(img):
|
|
24 |
visualization=True)
|
25 |
im = Image.fromarray(result[0]['mask'])
|
26 |
im.save("./data/data_mask.png")
|
|
|
27 |
os.system('python predict.py model.path=/home/user/app/big-lama/ indir=./data outdir=./dataout device=cpu')
|
|
|
28 |
return "./dataout/data_mask.png"
|
29 |
inputs = gr.inputs.Image(type='pil', label="Original Image")
|
30 |
outputs = gr.outputs.Image(type="file",label="output")
|
|
|
15 |
model = hub.Module(name='U2Net')
|
16 |
def infer(img):
|
17 |
img.save("./data/data.png")
|
18 |
+
os.system("ls data")
|
19 |
result = model.Segmentation(
|
20 |
images=[cv2.cvtColor(np.array(img), cv2.COLOR_RGB2BGR)],
|
21 |
paths=None,
|
|
|
25 |
visualization=True)
|
26 |
im = Image.fromarray(result[0]['mask'])
|
27 |
im.save("./data/data_mask.png")
|
28 |
+
os.system("ls data")
|
29 |
os.system('python predict.py model.path=/home/user/app/big-lama/ indir=./data outdir=./dataout device=cpu')
|
30 |
+
os.system("ls dataout")
|
31 |
return "./dataout/data_mask.png"
|
32 |
inputs = gr.inputs.Image(type='pil', label="Original Image")
|
33 |
outputs = gr.outputs.Image(type="file",label="output")
|