Spaces:
Running
on
Zero
Running
on
Zero
daidedou
commited on
Commit
·
3c50fb3
1
Parent(s):
75e6288
add GPU
Browse files
app.py
CHANGED
|
@@ -19,6 +19,7 @@ import tempfile
|
|
| 19 |
from typing import Dict, Tuple, Optional
|
| 20 |
from omegaconf import OmegaConf
|
| 21 |
import gradio as gr
|
|
|
|
| 22 |
import numpy as np
|
| 23 |
import trimesh
|
| 24 |
import zero_shot
|
|
@@ -156,7 +157,7 @@ def build_outputs(surf_a: Surface, surf_b: Surface, cmap_a: np.ndarray, p2p: np.
|
|
| 156 |
out_file = save_array_txt(p2p)
|
| 157 |
return glb_a, glb_b, out_file
|
| 158 |
|
| 159 |
-
|
| 160 |
def init_clicked(mesh1_path, mesh2_path,
|
| 161 |
lambda_val, zoomout_val, time_val, nloop_val, sds_val, proper_val):
|
| 162 |
cfg.deepfeat_conf.fmap.lambda_ = lambda_val
|
|
@@ -177,7 +178,7 @@ def init_clicked(mesh1_path, mesh2_path,
|
|
| 177 |
p2p_init, _ = extract_p2p_torch_fmap(C12_obj, datadicts.shape_dict["evecs"], datadicts.target_dict["evecs"])
|
| 178 |
return build_outputs(datadicts.shape_surf, datadicts.target_surf, datadicts.cmap1, p2p_init, tag="init")
|
| 179 |
|
| 180 |
-
|
| 181 |
def run_clicked(mesh1_path, mesh2_path, yaml_path, lambda_val, zoomout_val, time_val, nloop_val, sds_val, proper_val, progress=gr.Progress(track_tqdm=True)):
|
| 182 |
if not mesh1_path or not mesh2_path:
|
| 183 |
raise gr.Error("Please upload both meshes.")
|
|
|
|
| 19 |
from typing import Dict, Tuple, Optional
|
| 20 |
from omegaconf import OmegaConf
|
| 21 |
import gradio as gr
|
| 22 |
+
import spaces
|
| 23 |
import numpy as np
|
| 24 |
import trimesh
|
| 25 |
import zero_shot
|
|
|
|
| 157 |
out_file = save_array_txt(p2p)
|
| 158 |
return glb_a, glb_b, out_file
|
| 159 |
|
| 160 |
+
@spaces.GPU
|
| 161 |
def init_clicked(mesh1_path, mesh2_path,
|
| 162 |
lambda_val, zoomout_val, time_val, nloop_val, sds_val, proper_val):
|
| 163 |
cfg.deepfeat_conf.fmap.lambda_ = lambda_val
|
|
|
|
| 178 |
p2p_init, _ = extract_p2p_torch_fmap(C12_obj, datadicts.shape_dict["evecs"], datadicts.target_dict["evecs"])
|
| 179 |
return build_outputs(datadicts.shape_surf, datadicts.target_surf, datadicts.cmap1, p2p_init, tag="init")
|
| 180 |
|
| 181 |
+
@spaces.GPU
|
| 182 |
def run_clicked(mesh1_path, mesh2_path, yaml_path, lambda_val, zoomout_val, time_val, nloop_val, sds_val, proper_val, progress=gr.Progress(track_tqdm=True)):
|
| 183 |
if not mesh1_path or not mesh2_path:
|
| 184 |
raise gr.Error("Please upload both meshes.")
|