asteroid8898 commited on
Commit
06608a9
·
verified ·
1 Parent(s): da4ac9b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -11
app.py CHANGED
@@ -3,28 +3,31 @@ import os
3
  import torch
4
 
5
  if torch.cuda.is_available():
6
- device="cuda"
7
  print("Using GPU")
8
  else:
9
- device="cpu"
10
  print("Using CPU")
11
 
 
 
 
 
 
 
12
 
13
  # Clone the repository
14
  subprocess.run(["git", "clone", "https://github.com/AiAsteroid/NBOX.git", "--single-branch"], check=True)
15
- # chande directory to face fusion to run ui
16
  os.chdir("NBOX")
17
 
18
-
19
- # installation
20
  if device == "cuda":
21
  subprocess.run(["python", "install.py", "--onnxruntime", "cuda", "--skip-conda"], check=True)
22
- elif device == "cpu":
23
  subprocess.run(["python", "install.py", "--onnxruntime", "default", "--skip-conda"], check=True)
24
 
 
 
25
 
26
- # Run the ui
27
- if device == "cuda":
28
- subprocess.run(["python", "run.py", "--execution-providers", "cuda"], check=True)
29
- elif device == "cpu":
30
- subprocess.run(["python", "run.py", "--execution-providers", "cpu"], check=True)
 
3
  import torch
4
 
5
  if torch.cuda.is_available():
6
+ device = "cuda"
7
  print("Using GPU")
8
  else:
9
+ device = "cpu"
10
  print("Using CPU")
11
 
12
+ # Upgrade pip
13
+ subprocess.run(["pip", "install", "--upgrade", "pip"], check=True)
14
+
15
+ # Fix sympy dependency
16
+ subprocess.run(["pip", "uninstall", "-y", "sympy"], check=True)
17
+ subprocess.run(["pip", "install", "sympy==1.13.1"], check=True)
18
 
19
  # Clone the repository
20
  subprocess.run(["git", "clone", "https://github.com/AiAsteroid/NBOX.git", "--single-branch"], check=True)
 
21
  os.chdir("NBOX")
22
 
23
+ # Install dependencies
 
24
  if device == "cuda":
25
  subprocess.run(["python", "install.py", "--onnxruntime", "cuda", "--skip-conda"], check=True)
26
+ else:
27
  subprocess.run(["python", "install.py", "--onnxruntime", "default", "--skip-conda"], check=True)
28
 
29
+ # Check if installation was successful
30
+ subprocess.run(["python", "install.py", "--check"], check=True)
31
 
32
+ # Run the UI
33
+ subprocess.run(["python", "run.py", "--execution-providers", device], check=True)