File size: 1,680 Bytes
4f0e45f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import subprocess
import gradio as gr

def install_pygit2():
    """Installs pygit2 with a specific version (if necessary).

    This function attempts to install pygit2 using pip. If installation
    fails, it provides guidance on potential solutions.
    """

    try:
        subprocess.run(["pip", "install", "pygit2==1.12.2"], check=True)
        print("pygit2 version 1.12.2 installed successfully.")
    except subprocess.CalledProcessError:
        print("Error installing pygit2. You might need to install it manually.")
        print("For instructions, refer to the pygit2 documentation:")
        print("https://www.pygit2.org/install.html")

def clone_and_run_fooocus():
    """Clones the Fooocus repository and executes the entry_with_update.py script.

    This function assumes the script is located in the project's root directory.
    It provides informative messages throughout the process.
    """

    print("Cloning the Fooocus repository...")
    try:
        subprocess.run(["git", "clone", "https://github.com/lllyasviel/Fooocus.git"], check=True)
        print("Fooocus repository cloned successfully.")
        print("Changing directory to Fooocus...")
        subprocess.run(["cd", "Fooocus"], check=True)
        print("Executing entry_with_update.py...")
        subprocess.run(["python", "entry_with_update.py", "--share", "--always-high-vram"], check=True)
        print("Fooocus script execution complete.")
    except subprocess.CalledProcessError as e:
        print(f"An error occurred: {e}")
        print("Please ensure you have Git and Python installed correctly.")

if __name__ == "__main__":
    install_pygit2()
    clone_and_run_fooocus()