QuintW commited on
Commit
d3c027d
1 Parent(s): d4a6d4e

update hopelijk beter

Browse files
Files changed (1) hide show
  1. app.py +22 -9
app.py CHANGED
@@ -5,17 +5,25 @@ initial_repo_path = "/home/user/app/stable-diffusion-webui"
5
  initial_repo_url = "https://github.com/camenduru/stable-diffusion-webui"
6
  initial_branch = "v2.6"
7
  os.chdir("/home/user/app")
8
- os.system(f"git clone -b {initial_branch} {initial_repo_url} {initial_repo_path}")
 
 
 
 
 
 
 
9
 
10
  # Change directory to the cloned repository
11
  os.chdir(initial_repo_path)
12
 
13
- # Perform a git pull to update the repository
14
- os.system("git pull")
15
-
16
  # Clone the Controlnet extension
17
  controlnet_repo_url = "https://github.com/Mikubill/sd-webui-controlnet"
18
- os.system(f"git clone {controlnet_repo_url} {initial_repo_path}/controlnet")
 
 
 
 
19
 
20
  # Continue with the rest of your setup...
21
  os.chdir(initial_repo_path)
@@ -29,7 +37,12 @@ os.system(f"git lfs install")
29
  # os.system(f"sed -i -e '108,113d' modules/ui_settings.py")
30
  # os.system(f"sed -i -e '225,227d' modules/ui_loadsave.py")
31
  # os.system(f"sed -i -e '214,217d' modules/ui_loadsave.py")
32
- os.system(f"rm -rfv scripts/")
33
- os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/counterfeit-xl/resolve/main/counterfeitxl_v10.safetensors -d models/Stable-diffusion -o counterfeitxl_v10.safetensors")
34
- # os.system(f"python launch.py --api --cors-allow-origins=* --xformers --theme dark --gradio-queue --ui-settings-file /home/user/app/shared-config_v2.json --ui-config-file /home/user/app/shared-ui-config_v2.json")
35
- os.system(f"python launch.py --api --cors-allow-origins=* --theme dark --gradio-queue --ui-settings-file /home/user/app/shared-config_v2.json --ui-config-file /home/user/app/shared-ui-config_v2.json")
 
 
 
 
 
 
5
  initial_repo_url = "https://github.com/camenduru/stable-diffusion-webui"
6
  initial_branch = "v2.6"
7
  os.chdir("/home/user/app")
8
+
9
+ # Check if the repository already exists
10
+ if not os.path.exists(initial_repo_path):
11
+ os.system(f"git clone -b {initial_branch} {initial_repo_url} {initial_repo_path}")
12
+ else:
13
+ # If the repository exists, update it
14
+ os.chdir(initial_repo_path)
15
+ os.system("git pull")
16
 
17
  # Change directory to the cloned repository
18
  os.chdir(initial_repo_path)
19
 
 
 
 
20
  # Clone the Controlnet extension
21
  controlnet_repo_url = "https://github.com/Mikubill/sd-webui-controlnet"
22
+ controlnet_repo_path = os.path.join(initial_repo_path, "controlnet")
23
+
24
+ # Check if the controlnet repository already exists
25
+ if not os.path.exists(controlnet_repo_path):
26
+ os.system(f"git clone {controlnet_repo_url} {controlnet_repo_path}")
27
 
28
  # Continue with the rest of your setup...
29
  os.chdir(initial_repo_path)
 
37
  # os.system(f"sed -i -e '108,113d' modules/ui_settings.py")
38
  # os.system(f"sed -i -e '225,227d' modules/ui_loadsave.py")
39
  # os.system(f"sed -i -e '214,217d' modules/ui_loadsave.py")
40
+
41
+ # Create the 'scripts/' directory if it doesn't exist
42
+ os.makedirs("scripts", exist_ok=True)
43
+
44
+ # Download the necessary file
45
+ os.system("aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/counterfeit-xl/resolve/main/counterfeitxl_v10.safetensors -d models/Stable-diffusion -o counterfeitxl_v10.safetensors")
46
+
47
+ # Run the application
48
+ os.system("python launch.py --api --cors-allow-origins=* --theme dark --gradio-queue --ui-settings-file /home/user/app/shared-config_v2.json --ui-config-file /home/user/app/shared-ui-config_v2.json")