|
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") |
|
|
|
|
|
subprocess.run(["git", "clone", "https://github.com/facefusion/facefusion", "--branch", "2.5.2", "--single-branch"], check=True) |
|
|
|
os.chdir("facefusion") |
|
|
|
|
|
subprocess.run(["python", "install.py", "--onnxruntime", "cuda-11.8", "--skip-conda"], check=True) |
|
|
|
|
|
if device=="cuda": |
|
subprocess.run(["python", "run.py", "--execution-providers", "cuda"], check=True) |
|
else: |
|
subprocess.run(["python", "run.py", "--execution-providers", "cpu"], check=True) |