Spaces:
Runtime error
Runtime error
change logs
Browse files- PIFu/apps/eval_spaces.py +1 -1
- app.py +9 -6
- requirements.txt +3 -1
PIFu/apps/eval_spaces.py
CHANGED
@@ -38,7 +38,7 @@ class Evaluator:
|
|
38 |
])
|
39 |
# set cuda
|
40 |
cuda = torch.device('cuda:%d' % opt.gpu_id) if torch.cuda.is_available() else torch.device('cpu')
|
41 |
-
print("CUDDAAAAA ???", torch.cuda.get_device_name(0))
|
42 |
|
43 |
# create net
|
44 |
netG = HGPIFuNet(opt, projection_mode).to(device=cuda)
|
|
|
38 |
])
|
39 |
# set cuda
|
40 |
cuda = torch.device('cuda:%d' % opt.gpu_id) if torch.cuda.is_available() else torch.device('cpu')
|
41 |
+
print("CUDDAAAAA ???", torch.cuda.get_device_name(0) if torch.cuda.is_available() else "NO ONLY CPU")
|
42 |
|
43 |
# create net
|
44 |
netG = HGPIFuNet(opt, projection_mode).to(device=cuda)
|
app.py
CHANGED
@@ -1,5 +1,9 @@
|
|
1 |
import os
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
from pydoc import describe
|
4 |
from huggingface_hub import hf_hub_download
|
5 |
import gradio as gr
|
@@ -30,21 +34,20 @@ def process(img_path):
|
|
30 |
print("image name", img_name)
|
31 |
img = Image.open(img_path)
|
32 |
# remove background
|
33 |
-
print("
|
34 |
foreground = Image.fromarray(remove_bg.inference(img), 'RGBA')
|
35 |
foreground.save("./PIFu/inputs/" + img_name + ".png")
|
36 |
-
print("
|
37 |
subprocess.Popen(["python", "./apps/crop_img.py", "--input_image",
|
38 |
f'./inputs/{img_name}.png', "--out_path", "./inputs"], cwd="PIFu").communicate()
|
39 |
|
40 |
-
print("
|
41 |
subprocess.Popen("./scripts/test.sh", env={
|
42 |
**env,
|
43 |
"INPUT_IMAGE_PATH": f'./inputs/{img_name}.png',
|
44 |
"VOL_RES": "128"},
|
45 |
cwd="PIFu").communicate()
|
46 |
-
|
47 |
-
print("inference")
|
48 |
return f'./PIFu/results/spaces_demo/result_{img_name}.glb'
|
49 |
|
50 |
|
|
|
1 |
import os
|
2 |
+
try:
|
3 |
+
os.system("pip install --upgrade torch==1.11.0+cu113 torchvision==0.12.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html")
|
4 |
+
except Exception as e:
|
5 |
+
print(e)
|
6 |
+
|
7 |
from pydoc import describe
|
8 |
from huggingface_hub import hf_hub_download
|
9 |
import gradio as gr
|
|
|
34 |
print("image name", img_name)
|
35 |
img = Image.open(img_path)
|
36 |
# remove background
|
37 |
+
print("Removeing background")
|
38 |
foreground = Image.fromarray(remove_bg.inference(img), 'RGBA')
|
39 |
foreground.save("./PIFu/inputs/" + img_name + ".png")
|
40 |
+
print("Aliging mask with input training image")
|
41 |
subprocess.Popen(["python", "./apps/crop_img.py", "--input_image",
|
42 |
f'./inputs/{img_name}.png', "--out_path", "./inputs"], cwd="PIFu").communicate()
|
43 |
|
44 |
+
print("Generating 3D model")
|
45 |
subprocess.Popen("./scripts/test.sh", env={
|
46 |
**env,
|
47 |
"INPUT_IMAGE_PATH": f'./inputs/{img_name}.png',
|
48 |
"VOL_RES": "128"},
|
49 |
cwd="PIFu").communicate()
|
50 |
+
print("DONE 3D model")
|
|
|
51 |
return f'./PIFu/results/spaces_demo/result_{img_name}.glb'
|
52 |
|
53 |
|
requirements.txt
CHANGED
@@ -17,4 +17,6 @@ Shapely==1.7.0
|
|
17 |
six==1.14.0
|
18 |
tqdm==4.43.0
|
19 |
trimesh==3.5.23
|
20 |
-
xxhash==1.4.3
|
|
|
|
|
|
17 |
six==1.14.0
|
18 |
tqdm==4.43.0
|
19 |
trimesh==3.5.23
|
20 |
+
xxhash==1.4.3
|
21 |
+
torch==1.11
|
22 |
+
torchvision==0.12.0
|