Huiwenshi commited on
Commit
19b2773
·
verified ·
1 Parent(s): 243b12d

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. hg_app.py +3 -3
  2. hg_app_bak.py +34 -25
hg_app.py CHANGED
@@ -105,7 +105,7 @@ def build_model_viewer_html(save_folder, height=660, width=790, textured=False):
105
  </div>
106
  """
107
 
108
- @spaces.GPU(duration=40)
109
  def _gen_shape(
110
  caption,
111
  image,
@@ -164,7 +164,7 @@ def _gen_shape(
164
  stats['time'] = time_meta
165
  return mesh, save_folder
166
 
167
- @spaces.GPU(duration=60)
168
  def generation_all(
169
  caption,
170
  image,
@@ -197,7 +197,7 @@ def generation_all(
197
  model_viewer_html_textured,
198
  )
199
 
200
- @spaces.GPU(duration=40)
201
  def shape_generation(
202
  caption,
203
  image,
 
105
  </div>
106
  """
107
 
108
+ @spaces.GPU(duration=60)
109
  def _gen_shape(
110
  caption,
111
  image,
 
164
  stats['time'] = time_meta
165
  return mesh, save_folder
166
 
167
+ @spaces.GPU(duration=120)
168
  def generation_all(
169
  caption,
170
  image,
 
197
  model_viewer_html_textured,
198
  )
199
 
200
+ @spaces.GPU(duration=60)
201
  def shape_generation(
202
  caption,
203
  image,
hg_app_bak.py CHANGED
@@ -1,28 +1,38 @@
1
- # pip install gradio==3.39.0
2
- import os
3
- import subprocess
4
- def install_cuda_toolkit():
5
- # CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
6
- CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
7
- CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
8
- subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
9
- subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
10
- subprocess.call([CUDA_TOOLKIT_FILE, "--silent", "--toolkit"])
11
-
12
- os.environ["CUDA_HOME"] = "/usr/local/cuda"
13
- os.environ["PATH"] = "%s/bin:%s" % (os.environ["CUDA_HOME"], os.environ["PATH"])
14
- os.environ["LD_LIBRARY_PATH"] = "%s/lib:%s" % (
15
- os.environ["CUDA_HOME"],
16
- "" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
17
- )
18
- # Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
19
- os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
20
-
21
- install_cuda_toolkit()
22
- os.system("cd /home/user/app/hy3dgen/texgen/differentiable_renderer/ && bash compile_mesh_painter.sh")
23
- os.system("cd /home/user/app/hy3dgen/texgen/custom_rasterizer && pip install .")
24
- # os.system("cd /home/user/app/hy3dgen/texgen/custom_rasterizer && CUDA_HOME=/usr/local/cuda FORCE_CUDA=1 TORCH_CUDA_ARCH_LIST='8.0;8.6;8.9;9.0' python setup.py install")
 
 
 
 
 
 
 
 
 
25
 
 
26
  import shutil
27
  import time
28
  from glob import glob
@@ -30,7 +40,6 @@ import gradio as gr
30
  import torch
31
  from gradio_litmodel3d import LitModel3D
32
 
33
- import spaces
34
 
35
  def get_example_img_list():
36
  print('Loading example img list ...')
 
1
+ # pip install gradio==4.44.1
2
+ if False:
3
+ import os
4
+ import spaces
5
+ import subprocess
6
+ def install_cuda_toolkit():
7
+ # CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
8
+ CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
9
+ CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
10
+ subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
11
+ subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
12
+ subprocess.call([CUDA_TOOLKIT_FILE, "--silent", "--toolkit"])
13
+
14
+ os.environ["CUDA_HOME"] = "/usr/local/cuda"
15
+ os.environ["PATH"] = "%s/bin:%s" % (os.environ["CUDA_HOME"], os.environ["PATH"])
16
+ os.environ["LD_LIBRARY_PATH"] = "%s/lib:%s" % (
17
+ os.environ["CUDA_HOME"],
18
+ "" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
19
+ )
20
+ # Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
21
+ os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
22
+
23
+ install_cuda_toolkit()
24
+ os.system("cd /home/user/app/hy3dgen/texgen/differentiable_renderer/ && bash compile_mesh_painter.sh")
25
+ os.system("cd /home/user/app/hy3dgen/texgen/custom_rasterizer && pip install .")
26
+ # os.system("cd /home/user/app/hy3dgen/texgen/custom_rasterizer && CUDA_HOME=/usr/local/cuda FORCE_CUDA=1 TORCH_CUDA_ARCH_LIST='8.0;8.6;8.9;9.0' python setup.py install")
27
+ else:
28
+ class spaces:
29
+ class GPU:
30
+ def __init__(self, duration=60):
31
+ self.duration = duration
32
+ def __call__(self, func):
33
+ return func
34
 
35
+ import os
36
  import shutil
37
  import time
38
  from glob import glob
 
40
  import torch
41
  from gradio_litmodel3d import LitModel3D
42
 
 
43
 
44
  def get_example_img_list():
45
  print('Loading example img list ...')