vorstcavry commited on
Commit
c63a9ca
·
1 Parent(s): 6087456

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -9
app.py CHANGED
@@ -40,8 +40,24 @@ os.chdir(str(user_home))
40
  #clone stable-diffusion-webui repo
41
  print("cloning stable-diffusion-webui repo")
42
  Gitclone(r"https://github.com/AUTOMATIC1111/stable-diffusion-webui.git",user_home / r"stable-diffusion-webui")
43
- os.chdir(str(user_home / r"stable-diffusion-webui"))
44
  #os.system("git reset --hard "+commit_id)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  #install extensions
46
  print("installing extensions")
47
  Gitclone(r"https://github.com/vorstcavry/embeddings",user_home / r"stable-diffusion-webui" / r"embeddings" / r"negative")
@@ -80,6 +96,7 @@ Gitclone(r"https://tinyurl.com/aspect-ratio-v",user_home / r"stable-diffusion-we
80
  Gitclone(r"https://github.com/hnmr293/sd-webui-llul",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-llul")
81
  Gitclone(r"https://github.com/IDEA-Research/DWPose",user_home / r"stable-diffusion-webui" / r"extensions" / r"DWPose")
82
  Gitclone(r"https://github.com/Bing-su/adetailer",user_home / r"stable-diffusion-webui" / r"extensions" / r"adetailer")
 
83
 
84
 
85
  #Gitclone(r"https://github.com/NoCrypt/sd_hf_out",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd_hf_out")
@@ -197,12 +214,30 @@ DownLoad(r"https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv
197
  #strt Stable Diffusion Webui
198
  print("Done\nStarting Webui...")
199
  os.chdir(user_home / r"stable-diffusion-webui")
200
- gc.collect()
201
- while True:
202
- ret=subprocess.run([executable ,user_home / r"stable-diffusion-webui" / r"launch.py",r"--precision",r"full",r"--no-half",r"--no-half-vae",r"--enable-insecure-extension-access",r"--medvram",r"--skip-torch-cuda-test",r"--enable-console-prompts",r"--ui-settings-file="+str(pathlib.Path(__file__).parent /r"config.json")])
203
- if(ret.returncode == 0 ):
204
- del ret
205
- gc.collect()
206
- else :
207
- del ret
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  del os ,user_home ,pyexecutable ,subprocess
 
40
  #clone stable-diffusion-webui repo
41
  print("cloning stable-diffusion-webui repo")
42
  Gitclone(r"https://github.com/AUTOMATIC1111/stable-diffusion-webui.git",user_home / r"stable-diffusion-webui")
43
+ #os.chdir(str(user_home / r"stable-diffusion-webui"))
44
  #os.system("git reset --hard "+commit_id)
45
+ os.chdir(user_home / r"stable-diffusion-webui")
46
+ Gitclone(r"https://github.com/vorstcavry/ncpt_colab_timer",user_home / r"stable-diffusion-webui" / r"extensions" / r"ncpt_colab_timer")
47
+ Gitclone(r"https://github.com/vorstcavry/static",user_home / r"stable-diffusion-webui" / r"static")
48
+
49
+ def run_echo_command():
50
+ try:
51
+ start_huggingface
52
+ except NameError:
53
+ start_huggingface = int(time.time()) - 5
54
+
55
+ cmd = f"echo -n {start_huggingface} > /home/user/app/stable-diffusion-webui/static/colabTimer.txt"
56
+ subprocess.run(cmd, shell=True)
57
+
58
+ # Contoh pemanggilan fungsi run_echo_command:
59
+ run_echo_command()
60
+ os.chdir(user_home / r"stable-diffusion-webui")
61
  #install extensions
62
  print("installing extensions")
63
  Gitclone(r"https://github.com/vorstcavry/embeddings",user_home / r"stable-diffusion-webui" / r"embeddings" / r"negative")
 
96
  Gitclone(r"https://github.com/hnmr293/sd-webui-llul",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-llul")
97
  Gitclone(r"https://github.com/IDEA-Research/DWPose",user_home / r"stable-diffusion-webui" / r"extensions" / r"DWPose")
98
  Gitclone(r"https://github.com/Bing-su/adetailer",user_home / r"stable-diffusion-webui" / r"extensions" / r"adetailer")
99
+ Gitclone(r"https://github.com/NoCrypt/sd_hf_out",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd_hf_out")
100
 
101
 
102
  #Gitclone(r"https://github.com/NoCrypt/sd_hf_out",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd_hf_out")
 
214
  #strt Stable Diffusion Webui
215
  print("Done\nStarting Webui...")
216
  os.chdir(user_home / r"stable-diffusion-webui")
217
+ import subprocess
218
+ import pathlib
219
+
220
+ user_home = pathlib.Path("/home/user") # Gantilah dengan path yang sesuai
221
+
222
+ args = [
223
+ executable,
224
+ user_home / "stable-diffusion-webui" / "launch.py",
225
+ "--precision", "full",
226
+ "--no-half",
227
+ "--no-half-vae",
228
+ "--enable-insecure-extension-access",
229
+ "--medvram",
230
+ "--skip-torch-cuda-test",
231
+ "--enable-console-prompts",
232
+ "--ui-settings-file=" + str(pathlib.Path(__file__).parent / "config.json"),
233
+ "--hf-token-out",
234
+ "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" # Gantilah dengan token yang sesuai
235
+ ]
236
+
237
+ args = [arg.as_posix() if isinstance(arg, pathlib.PosixPath) else arg for arg in args]
238
+
239
+ try:
240
+ ret = subprocess.run(args)
241
+ except Exception as e:
242
+ print("Error:", e)
243
  del os ,user_home ,pyexecutable ,subprocess