Spaces:
LULDev
/
4
Runtime error

4 / app.py
Nick088's picture
added installing nvidia cuda toolkit for paid gpu duplications to be sure they use cuda to be faster
6328231 verified
raw
history blame
784 Bytes
import subprocess
import os
import torch
if torch.cuda.is_available():
subprocess.run(["apt-get", "install", "-y", "nvidia-cuda-toolkit"], check=True)
device="cuda"
print("Using GPU")
else:
device="cpu"
print("Using CPU")
# Clone the repository
subprocess.run(["git", "clone", "https://github.com/facefusion/facefusion", "--branch", "2.5.2", "--single-branch"], check=True)
# chande directory to face fusion to run ui
os.chdir("facefusion")
# installation
subprocess.run(["python", "install.py", "--onnxruntime", "cuda-11.8", "--skip-conda"], check=True)
# Run the ui
if device=="cuda":
subprocess.run(["python", "run.py", "--execution-providers", "cpu", "cuda"], check=True)
else:
subprocess.run(["python", "run.py", "--execution-providers", "cpu"], check=True)