Huiwenshi commited on
Commit
390d99a
1 Parent(s): a7aa7d6

Upload app_hg.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app_hg.py +13 -7
app_hg.py CHANGED
@@ -51,6 +51,7 @@ from glob import glob
51
 
52
  # check_env()
53
 
 
54
  def install_cuda_toolkit():
55
  # CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
56
  CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
@@ -67,15 +68,20 @@ def install_cuda_toolkit():
67
  )
68
  # Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
69
  os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
70
- try:
71
- subprocess.check_call([sys.executable, "-m", "pip", "install", "-U", "git+https://github.com/facebookresearch/pytorch3d@stable"])
72
- import pytorch3d
73
- except Exception as err:
74
- print(err)
75
- print("new inner cuda install pytorch3d fail")
 
 
 
 
 
76
 
77
  install_cuda_toolkit()
78
-
79
 
80
  from infer import seed_everything, save_gif
81
  from infer import Text2Image, Removebg, Image2Views, Views2Mesh, GifRenderer
 
51
 
52
  # check_env()
53
 
54
+ @spaces.GPU
55
  def install_cuda_toolkit():
56
  # CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
57
  CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
 
68
  )
69
  # Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
70
  os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
71
+ # try:
72
+ # subprocess.check_call([sys.executable, "-m", "pip", "install", "-U", "git+https://github.com/facebookresearch/pytorch3d@stable"])
73
+ # import pytorch3d
74
+ # except Exception as err:
75
+ # print(err)
76
+ # print("new inner cuda install pytorch3d fail")
77
+
78
+ @spaces.GPU
79
+ def install_requirements():
80
+ # Install the packages listed in requirements.txt
81
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
82
 
83
  install_cuda_toolkit()
84
+ install_requirements()
85
 
86
  from infer import seed_everything, save_gif
87
  from infer import Text2Image, Removebg, Image2Views, Views2Mesh, GifRenderer