Spaces:
Runtime error
Runtime error
Ahsen Khaliq
commited on
Commit
•
b483613
1
Parent(s):
271de52
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,8 @@ import gradio as gr
|
|
7 |
import torch
|
8 |
from PIL import Image
|
9 |
import numpy as np
|
10 |
-
|
|
|
11 |
# Images
|
12 |
torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2018/08/12/16/59/ara-3601194_1280.jpg', 'parrot.jpg')
|
13 |
torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2016/10/21/14/46/fox-1758183_1280.jpg', 'fox.jpg')
|
@@ -25,8 +26,8 @@ def infer(img):
|
|
25 |
im.save("./data/data_mask.png")
|
26 |
os.system('python predict.py model.path=./big-lama indir=./data outdir=./dataout device=cpu')
|
27 |
return "./dataout/data_mask.png"
|
28 |
-
inputs = gr.inputs.Image(type='
|
29 |
-
outputs = gr.outputs.Image(type="
|
30 |
title = "U^2-Net"
|
31 |
description = "demo for U^2-Net. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
|
32 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2005.09007'>U^2-Net: Going Deeper with Nested U-Structure for Salient Object Detection</a> | <a href='https://github.com/xuebinqin/U-2-Net'>Github Repo</a></p>"
|
|
|
7 |
import torch
|
8 |
from PIL import Image
|
9 |
import numpy as np
|
10 |
+
os.mkdir("data")
|
11 |
+
os.mkdir("dataout")
|
12 |
# Images
|
13 |
torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2018/08/12/16/59/ara-3601194_1280.jpg', 'parrot.jpg')
|
14 |
torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2016/10/21/14/46/fox-1758183_1280.jpg', 'fox.jpg')
|
|
|
26 |
im.save("./data/data_mask.png")
|
27 |
os.system('python predict.py model.path=./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")
|
31 |
title = "U^2-Net"
|
32 |
description = "demo for U^2-Net. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
|
33 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2005.09007'>U^2-Net: Going Deeper with Nested U-Structure for Salient Object Detection</a> | <a href='https://github.com/xuebinqin/U-2-Net'>Github Repo</a></p>"
|