Spaces:
Runtime error
Runtime error
SerdarHelli
commited on
Commit
•
7872317
1
Parent(s):
d5c0caa
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,8 @@ import plotly.graph_objects as go
|
|
4 |
import sys
|
5 |
import torch
|
6 |
from huggingface_hub import hf_hub_download
|
|
|
|
|
7 |
|
8 |
os.system("git clone https://github.com/luost26/diffusion-point-cloud")
|
9 |
sys.path.append("diffusion-point-cloud")
|
@@ -17,8 +19,13 @@ chair=network_pkl=hf_hub_download("SerdarHelli/diffusion-point-cloud", filename=
|
|
17 |
|
18 |
device='cuda' if torch.cuda.is_available() else 'cpu'
|
19 |
|
20 |
-
ckpt_airplane = torch.load(airplane)
|
21 |
-
ckpt_chair = torch.load(chair)
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
def normalize_point_clouds(pcs,mode):
|
24 |
if mode is None:
|
@@ -67,7 +74,6 @@ def generate(seed,value):
|
|
67 |
else :
|
68 |
ckpt=ckpt_airplane
|
69 |
|
70 |
-
print(value)
|
71 |
colors=(238, 75, 43)
|
72 |
points=predict(seed,ckpt)
|
73 |
num_points=points.shape[0]
|
@@ -90,14 +96,13 @@ def generate(seed,value):
|
|
90 |
)
|
91 |
)
|
92 |
return fig
|
|
|
93 |
markdown=f'''
|
94 |
# Diffusion Probabilistic Models for 3D Point Cloud Generation
|
95 |
-
|
96 |
[[The Paper](https://arxiv.org/abs/2103.01458)] [[Original Code](https://github.com/luost26/diffusion-point-cloud)]
|
97 |
-
|
98 |
The space demo for our CVPR 2021 paper "Diffusion Probabilistic Models for 3D Point Cloud Generation".
|
99 |
|
100 |
-
|
101 |
'''
|
102 |
with gr.Blocks() as demo:
|
103 |
with gr.Column():
|
|
|
4 |
import sys
|
5 |
import torch
|
6 |
from huggingface_hub import hf_hub_download
|
7 |
+
import numpy as np
|
8 |
+
import random
|
9 |
|
10 |
os.system("git clone https://github.com/luost26/diffusion-point-cloud")
|
11 |
sys.path.append("diffusion-point-cloud")
|
|
|
19 |
|
20 |
device='cuda' if torch.cuda.is_available() else 'cpu'
|
21 |
|
22 |
+
ckpt_airplane = torch.load(airplane,map_location=torch.device(device))
|
23 |
+
ckpt_chair = torch.load(chair,map_location=torch.device(device))
|
24 |
+
|
25 |
+
def seed_all(seed):
|
26 |
+
torch.manual_seed(seed)
|
27 |
+
np.random.seed(seed)
|
28 |
+
random.seed(seed)
|
29 |
|
30 |
def normalize_point_clouds(pcs,mode):
|
31 |
if mode is None:
|
|
|
74 |
else :
|
75 |
ckpt=ckpt_airplane
|
76 |
|
|
|
77 |
colors=(238, 75, 43)
|
78 |
points=predict(seed,ckpt)
|
79 |
num_points=points.shape[0]
|
|
|
96 |
)
|
97 |
)
|
98 |
return fig
|
99 |
+
|
100 |
markdown=f'''
|
101 |
# Diffusion Probabilistic Models for 3D Point Cloud Generation
|
|
|
102 |
[[The Paper](https://arxiv.org/abs/2103.01458)] [[Original Code](https://github.com/luost26/diffusion-point-cloud)]
|
|
|
103 |
The space demo for our CVPR 2021 paper "Diffusion Probabilistic Models for 3D Point Cloud Generation".
|
104 |
|
105 |
+
It is running on {device}
|
106 |
'''
|
107 |
with gr.Blocks() as demo:
|
108 |
with gr.Column():
|