wyysf commited on
Commit
94cabf8
1 Parent(s): d3516a7
Files changed (2) hide show
  1. apps/gradio_app.py +2 -0
  2. apps/mv_models.py +5 -1
apps/gradio_app.py CHANGED
@@ -21,6 +21,7 @@ proj_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
21
  sys.path.append(os.path.join(proj_dir))
22
 
23
  import tempfile
 
24
 
25
  import craftsman
26
  from craftsman.systems.base import BaseSystem
@@ -68,6 +69,7 @@ If you have any questions, feel free to open a discussion or contact us at <b>we
68
  model = None
69
  cached_dir = None
70
 
 
71
  def image2mesh(view_front: np.ndarray,
72
  view_right: np.ndarray,
73
  view_back: np.ndarray,
 
21
  sys.path.append(os.path.join(proj_dir))
22
 
23
  import tempfile
24
+ import spaces
25
 
26
  import craftsman
27
  from craftsman.systems.base import BaseSystem
 
69
  model = None
70
  cached_dir = None
71
 
72
+ @spaces.GPU
73
  def image2mesh(view_front: np.ndarray,
74
  view_right: np.ndarray,
75
  view_back: np.ndarray,
apps/mv_models.py CHANGED
@@ -16,6 +16,7 @@ from typing import Dict, Optional, Tuple, List
16
  from dataclasses import dataclass
17
  from .utils import *
18
  from huggingface_hub import hf_hub_download
 
19
 
20
  parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
21
 
@@ -27,7 +28,8 @@ class GenMVImage(object):
27
  self.step = 50
28
  self.pipelines = {}
29
  self.device = device
30
-
 
31
  def gen_image_from_crm(self, image):
32
  from .third_party.CRM.pipelines import TwoStagePipeline
33
  stage1_config = OmegaConf.load(f"{parent_dir}/apps/third_party/CRM/configs/nf7_v3_SNR_rd_size_stroke.yaml").config
@@ -50,6 +52,7 @@ class GenMVImage(object):
50
  mv_imgs = rt_dict["stage1_images"]
51
  return mv_imgs[5], mv_imgs[3], mv_imgs[2], mv_imgs[0]
52
 
 
53
  def gen_image_from_mvdream(self, image, text):
54
  from .third_party.mvdream_diffusers.pipeline_mvdream import MVDreamPipeline
55
  if image is None:
@@ -94,6 +97,7 @@ class GenMVImage(object):
94
  )
95
  return mv_imgs[1], mv_imgs[2], mv_imgs[3], mv_imgs[0]
96
 
 
97
  def gen_image_from_wonder3d(self, image, crop_size):
98
  sys.path.append(f"{parent_dir}/apps/third_party/Wonder3D")
99
  from diffusers import DiffusionPipeline # only tested on diffusers[torch]==0.19.3, may have conflicts with newer versions of diffusers
 
16
  from dataclasses import dataclass
17
  from .utils import *
18
  from huggingface_hub import hf_hub_download
19
+ import spaces
20
 
21
  parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
22
 
 
28
  self.step = 50
29
  self.pipelines = {}
30
  self.device = device
31
+
32
+ @spaces.GPU
33
  def gen_image_from_crm(self, image):
34
  from .third_party.CRM.pipelines import TwoStagePipeline
35
  stage1_config = OmegaConf.load(f"{parent_dir}/apps/third_party/CRM/configs/nf7_v3_SNR_rd_size_stroke.yaml").config
 
52
  mv_imgs = rt_dict["stage1_images"]
53
  return mv_imgs[5], mv_imgs[3], mv_imgs[2], mv_imgs[0]
54
 
55
+ @spaces.GPU
56
  def gen_image_from_mvdream(self, image, text):
57
  from .third_party.mvdream_diffusers.pipeline_mvdream import MVDreamPipeline
58
  if image is None:
 
97
  )
98
  return mv_imgs[1], mv_imgs[2], mv_imgs[3], mv_imgs[0]
99
 
100
+ @spaces.GPU
101
  def gen_image_from_wonder3d(self, image, crop_size):
102
  sys.path.append(f"{parent_dir}/apps/third_party/Wonder3D")
103
  from diffusers import DiffusionPipeline # only tested on diffusers[torch]==0.19.3, may have conflicts with newer versions of diffusers