Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,26 @@
|
|
1 |
import subprocess
|
2 |
import os
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
# Install the correct version of pygit2
|
5 |
-
|
6 |
|
7 |
-
# Clone the repository
|
8 |
repo_url = "https://github.com/lllyasviel/Fooocus.git"
|
9 |
-
repo_dir = "/home/user/app/Fooocus"
|
10 |
|
11 |
if not os.path.exists(repo_dir):
|
12 |
-
|
13 |
|
14 |
# Change to the cloned directory
|
15 |
os.chdir(repo_dir)
|
16 |
|
17 |
# Run the python script
|
18 |
-
|
|
|
1 |
import subprocess
|
2 |
import os
|
3 |
|
4 |
+
def run_command(cmd):
|
5 |
+
result = subprocess.run(cmd, capture_output=True, text=True)
|
6 |
+
if result.returncode != 0:
|
7 |
+
print(f"Error running command: {' '.join(cmd)}")
|
8 |
+
print(result.stderr)
|
9 |
+
else:
|
10 |
+
print(result.stdout)
|
11 |
+
|
12 |
# Install the correct version of pygit2
|
13 |
+
run_command(["pip", "install", "pygit2==1.15.1"])
|
14 |
|
15 |
+
# Clone the repository if it doesn't already exist
|
16 |
repo_url = "https://github.com/lllyasviel/Fooocus.git"
|
17 |
+
repo_dir = "/home/user/app/Fooocus"
|
18 |
|
19 |
if not os.path.exists(repo_dir):
|
20 |
+
run_command(["git", "clone", repo_url, repo_dir])
|
21 |
|
22 |
# Change to the cloned directory
|
23 |
os.chdir(repo_dir)
|
24 |
|
25 |
# Run the python script
|
26 |
+
run_command(["python", "entry_with_update.py", "--share", "--always-high-vram"])
|