Spaces:
Build error
Build error
Update app.py
Browse files
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 |
-
|
| 23 |
subprocess.run(["python", "install.py", "--onnxruntime", "default", "--skip-conda"], check=True)
|
| 24 |
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
# Run the
|
| 27 |
-
|
| 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)
|
|
|
|
|
|
|
|
|