File size: 1,268 Bytes
1ebe84f
962014c
ebc81de
5f091f6
 
 
3e49366
5f091f6
 
3e49366
5f091f6
60e78ea
1ebe84f
 
 
 
 
298cb83
1ebe84f
ebc81de
 
298cb83
1ebe84f
5f091f6
1ebe84f
 
 
 
 
5f091f6
298cb83
1ebe84f
6390cb6
1ebe84f
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

import subprocess
import os
import torch

if torch.cuda.is_available():
  device="cuda"
  print("Using GPU")
else:
  device="cpu"
  print("Using CPU")


# get branch
git_branch = os.getenv('git_branch')


# Clone the repository
subprocess.run(["git", "clone", "https://github.com/facefusion/facefusion", "--branch", git_branch, "--single-branch"], check=True)
# chande directory to face fusion to run ui
os.chdir("facefusion")


# installation
if device == "cuda":
    subprocess.run(["python", "install.py", "--onnxruntime", "cuda-11.8", "--skip-conda"], check=True)
elif device == "cpu":
    subprocess.run(["python", "install.py", "--onnxruntime", "default", "--skip-conda"], check=True)


# Run the ui
if device == "cuda" and git_branch == "master":
    subprocess.run(["python", "run.py", "--execution-providers", "cuda"], check=True)
elif device == "cpu" and git_branch == "master":
    subprocess.run(["python", "run.py", "--execution-providers", "cpu"], check=True)
elif device == "cuda" and git_branch == "next":
    subprocess.run(["python", "facefusion.py", "run", "--execution-providers", "cuda"], check=True)
elif device == "cpu" and git_branch == "next":
    subprocess.run(["python", "facefusion.py", "run", "--execution-providers", "cpu"], check=True)