NBOX-test2 / app.py
asteroid8898's picture
Update app.py
91bcb53 verified
Raw
History Blame Contribute Delete
822 Bytes
import subprocess
import os
import torch
if torch.cuda.is_available():
device = "cuda"
print("Using GPU")
else:
device = "cpu"
print("Using CPU")
# Clone the repository
subprocess.run(["git", "clone", "https://github.com/AiAsteroid/NBOX.git", "--single-branch"], check=True)
os.chdir("NBOX")
# Install dependencies
onnx_provider = "cuda-12.2" if device == "cuda" else "default"
subprocess.run(["python", "install.py", "--onnxruntime", onnx_provider, "--skip-conda"], check=True)
# Check if installation was successful by listing installed packages
subprocess.run(["pip", "list"], check=True)
print("DID WE GET TO THE START?????")
# Run the UI
subprocess.run(["python", "run.py", "--execution-providers", device])
print("DID WE GET TO THE END?????")
subprocess.run(["cat", "ERROR.log"], check=True)