ar08 commited on
Commit
a8127f9
·
verified ·
1 Parent(s): fd7d2d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -21
app.py CHANGED
@@ -1,30 +1,18 @@
1
  import subprocess
2
  import os
3
- import torch
4
-
5
- if torch.cuda.is_available():
6
- device="cuda"
7
- print("Using GPU")
8
- else:
9
- device="cpu"
10
- print("Using CPU")
11
 
 
 
 
12
 
13
  # Clone the repository
14
  subprocess.run(["git", "clone", "https://github.com/facefusion/facefusion", "--single-branch"], check=True)
15
- # chande directory to face fusion to run ui
16
- os.chdir("facefusion")
17
 
 
 
18
 
19
- # installation
20
- if device == "cuda":
21
- subprocess.run(["python", "install.py", "--onnxruntime", "cuda", "--skip-conda"], check=True)
22
- elif device == "cpu":
23
- subprocess.run(["python", "install.py", "--onnxruntime", "default", "--skip-conda"], check=True)
24
-
25
 
26
- # Run the ui
27
- if device == "cuda":
28
- subprocess.run(["python", "facefusion.py", "run", "--execution-providers", "cuda"], check=True)
29
- elif device == "cpu":
30
- subprocess.run(["python", "facefusion.py", "run", "--execution-providers", "cpu"], check=True)
 
1
  import subprocess
2
  import os
 
 
 
 
 
 
 
 
3
 
4
+ # Set the device to CPU explicitly
5
+ device = "cpu"
6
+ print("Using CPU")
7
 
8
  # Clone the repository
9
  subprocess.run(["git", "clone", "https://github.com/facefusion/facefusion", "--single-branch"], check=True)
 
 
10
 
11
+ # Change directory to facefusion to run the UI
12
+ os.chdir("facefusion")
13
 
14
+ # Install dependencies for CPU mode
15
+ subprocess.run(["python", "install.py", "--onnxruntime", "default", "--skip-conda"], check=True)
 
 
 
 
16
 
17
+ # Run the UI in CPU mode
18
+ subprocess.run(["python", "facefusion.py", "run", "--execution-providers", "cpu"], check=True)