Update app.py
Browse files
app.py
CHANGED
@@ -100,6 +100,7 @@ else:
|
|
100 |
model_cache_dir = './ckpts/'
|
101 |
os.makedirs(model_cache_dir, exist_ok=True)
|
102 |
|
|
|
103 |
def get_render_cameras(batch_size=1, M=120, radius=4.0, elevation=20.0, is_flexicubes=False, fov=50):
|
104 |
"""
|
105 |
Get the rendering camera parameters.
|
@@ -169,7 +170,7 @@ def get_render_cameras(batch_size=1, M=120, radius=4.0, elevation=20.0, is_flexi
|
|
169 |
all_campos = torch.stack(all_campos, dim=0).unsqueeze(0).squeeze(2)
|
170 |
return all_mv, all_mvp, all_campos
|
171 |
|
172 |
-
|
173 |
def render_frames(model, planes, render_cameras, camera_pos, env, materials, render_size=512, chunk_size=1, is_flexicubes=False):
|
174 |
"""
|
175 |
Render frames from triplanes.
|
@@ -305,7 +306,7 @@ def preprocess(input_image, do_remove_background):
|
|
305 |
|
306 |
return input_image
|
307 |
|
308 |
-
|
309 |
def generate_mvs(input_image, sample_steps, sample_seed):
|
310 |
|
311 |
seed_everything(sample_seed)
|
@@ -352,7 +353,7 @@ def make_mesh(mesh_fpath, planes):
|
|
352 |
|
353 |
return mesh_fpath, mesh_glb_fpath
|
354 |
|
355 |
-
|
356 |
def make3d(images):
|
357 |
|
358 |
images = np.asarray(images, dtype=np.float32) / 255.0
|
|
|
100 |
model_cache_dir = './ckpts/'
|
101 |
os.makedirs(model_cache_dir, exist_ok=True)
|
102 |
|
103 |
+
@spaces.GPU
|
104 |
def get_render_cameras(batch_size=1, M=120, radius=4.0, elevation=20.0, is_flexicubes=False, fov=50):
|
105 |
"""
|
106 |
Get the rendering camera parameters.
|
|
|
170 |
all_campos = torch.stack(all_campos, dim=0).unsqueeze(0).squeeze(2)
|
171 |
return all_mv, all_mvp, all_campos
|
172 |
|
173 |
+
@spaces.GPU
|
174 |
def render_frames(model, planes, render_cameras, camera_pos, env, materials, render_size=512, chunk_size=1, is_flexicubes=False):
|
175 |
"""
|
176 |
Render frames from triplanes.
|
|
|
306 |
|
307 |
return input_image
|
308 |
|
309 |
+
@spaces.GPU
|
310 |
def generate_mvs(input_image, sample_steps, sample_seed):
|
311 |
|
312 |
seed_everything(sample_seed)
|
|
|
353 |
|
354 |
return mesh_fpath, mesh_glb_fpath
|
355 |
|
356 |
+
@spaces.GPU
|
357 |
def make3d(images):
|
358 |
|
359 |
images = np.asarray(images, dtype=np.float32) / 255.0
|