daanidev commited on
Commit
4f0e45f
1 Parent(s): d3ccc14

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -0
app.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import subprocess
2
+ import gradio as gr
3
+
4
+ def install_pygit2():
5
+ """Installs pygit2 with a specific version (if necessary).
6
+
7
+ This function attempts to install pygit2 using pip. If installation
8
+ fails, it provides guidance on potential solutions.
9
+ """
10
+
11
+ try:
12
+ subprocess.run(["pip", "install", "pygit2==1.12.2"], check=True)
13
+ print("pygit2 version 1.12.2 installed successfully.")
14
+ except subprocess.CalledProcessError:
15
+ print("Error installing pygit2. You might need to install it manually.")
16
+ print("For instructions, refer to the pygit2 documentation:")
17
+ print("https://www.pygit2.org/install.html")
18
+
19
+ def clone_and_run_fooocus():
20
+ """Clones the Fooocus repository and executes the entry_with_update.py script.
21
+
22
+ This function assumes the script is located in the project's root directory.
23
+ It provides informative messages throughout the process.
24
+ """
25
+
26
+ print("Cloning the Fooocus repository...")
27
+ try:
28
+ subprocess.run(["git", "clone", "https://github.com/lllyasviel/Fooocus.git"], check=True)
29
+ print("Fooocus repository cloned successfully.")
30
+ print("Changing directory to Fooocus...")
31
+ subprocess.run(["cd", "Fooocus"], check=True)
32
+ print("Executing entry_with_update.py...")
33
+ subprocess.run(["python", "entry_with_update.py", "--share", "--always-high-vram"], check=True)
34
+ print("Fooocus script execution complete.")
35
+ except subprocess.CalledProcessError as e:
36
+ print(f"An error occurred: {e}")
37
+ print("Please ensure you have Git and Python installed correctly.")
38
+
39
+ if __name__ == "__main__":
40
+ install_pygit2()
41
+ clone_and_run_fooocus()