Nick088 commited on
Commit
1ebe84f
β€’
1 Parent(s): c2952c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -5
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import subprocess
2
  import os
3
  import torch
@@ -9,16 +10,30 @@ else:
9
  device="cpu"
10
  print("Using CPU")
11
 
 
 
 
 
 
12
  # Clone the repository
13
- subprocess.run(["git", "clone", "https://github.com/facefusion/facefusion", "--branch", "2.6.1", "--single-branch"], check=True)
14
  # chande directory to face fusion to run ui
15
  os.chdir("facefusion")
16
 
 
17
  # installation
18
- subprocess.run(["python", "install.py", "--onnxruntime", "cuda-11.8", "--skip-conda"], check=True)
 
 
 
 
19
 
20
  # Run the ui
21
- if device=="cuda":
22
  subprocess.run(["python", "run.py", "--execution-providers", "cuda"], check=True)
23
- else:
24
- subprocess.run(["python", "run.py", "--execution-providers", "cpu"], check=True)
 
 
 
 
 
1
+
2
  import subprocess
3
  import os
4
  import torch
 
10
  device="cpu"
11
  print("Using CPU")
12
 
13
+
14
+ # get branch
15
+ git_branch = os.getenv('git_branch')
16
+
17
+
18
  # Clone the repository
19
+ subprocess.run(["git", "clone", "https://github.com/facefusion/facefusion", "--branch", git_branch, "--single-branch"], check=True)
20
  # chande directory to face fusion to run ui
21
  os.chdir("facefusion")
22
 
23
+
24
  # installation
25
+ if device == "cuda":
26
+ subprocess.run(["python", "install.py", "--onnxruntime", "cuda-11.8", "--skip-conda"], check=True)
27
+ elif device == "cpu":
28
+ subprocess.run(["python", "install.py", "--onnxruntime", "default", "--skip-conda"], check=True)
29
+
30
 
31
  # Run the ui
32
+ if device == "cuda" and git_branch == "master":
33
  subprocess.run(["python", "run.py", "--execution-providers", "cuda"], check=True)
34
+ elif device == "cpu" and git_branch == "master":
35
+ subprocess.run(["python", "run.py", "--execution-providers", "cpu"], check=True)
36
+ elif device == "cuda" and git_branch == "next":
37
+ subprocess.run(["python", "facefusion.py", "run", "--execution-providers", "cuda"], check=True)
38
+ elif device == "cpu" and git_branch == "next":
39
+ subprocess.run(["python", "facefusion.py", "run", "--execution-providers", "cpu"], check=True)