Spaces:
Running
Running
Update app.py
Browse files
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 |
-
#
|
20 |
-
|
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
|
27 |
-
|
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)
|
|
|
|
|
|