Huiwenshi commited on
Commit
c63867f
·
verified ·
1 Parent(s): e20d520

Upload gradio_app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. gradio_app.py +20 -0
gradio_app.py CHANGED
@@ -14,6 +14,26 @@ import torch
14
  import spaces
15
 
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  def get_example_img_list():
18
  print('Loading example img list ...')
19
  return sorted(glob('./assets/example_images/*.png'))
 
14
  import spaces
15
 
16
 
17
+ def install_cuda_toolkit():
18
+ # CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
19
+ CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
20
+ CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
21
+ subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
22
+ subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
23
+ subprocess.call([CUDA_TOOLKIT_FILE, "--silent", "--toolkit"])
24
+
25
+ os.environ["CUDA_HOME"] = "/usr/local/cuda"
26
+ os.environ["PATH"] = "%s/bin:%s" % (os.environ["CUDA_HOME"], os.environ["PATH"])
27
+ os.environ["LD_LIBRARY_PATH"] = "%s/lib:%s" % (
28
+ os.environ["CUDA_HOME"],
29
+ "" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
30
+ )
31
+ # Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
32
+ os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
33
+
34
+
35
+ install_cuda_toolkit()
36
+
37
  def get_example_img_list():
38
  print('Loading example img list ...')
39
  return sorted(glob('./assets/example_images/*.png'))