LTT commited on
Commit
7f8533b
1 Parent(s): f034db8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -27,6 +27,25 @@ from src.utils.infer_util import remove_background, resize_foreground, images_to
27
  import tempfile
28
  from huggingface_hub import hf_hub_download
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  print(f"GPU: {torch.cuda.is_available()}")
31
  if torch.cuda.is_available() and torch.cuda.device_count() >= 2:
32
  device0 = torch.device('cuda:0')
 
27
  import tempfile
28
  from huggingface_hub import hf_hub_download
29
 
30
+ def install_cuda_toolkit():
31
+ """
32
+ Installs CUDA Toolkit 12.1 using conda.
33
+ """
34
+ try:
35
+ print("Installing CUDA Toolkit 12.1...")
36
+ # Run the conda install command
37
+ subprocess.check_call([
38
+ sys.executable, "-m", "conda", "install", "cuda", "-c", "nvidia/label/cuda-12.1.0", "-y"
39
+ ])
40
+ print("CUDA Toolkit 12.1 installed successfully.")
41
+ except subprocess.CalledProcessError as e:
42
+ print(f"Failed to install CUDA Toolkit: {e}")
43
+ except Exception as e:
44
+ print(f"An unexpected error occurred: {e}")
45
+
46
+ install_cuda_toolkit()
47
+
48
+
49
  print(f"GPU: {torch.cuda.is_available()}")
50
  if torch.cuda.is_available() and torch.cuda.device_count() >= 2:
51
  device0 = torch.device('cuda:0')