TheLastBen
commited on
Commit
·
11c9d70
1
Parent(s):
0a7dd8f
Update Scripts/mainpaperspaceA1111.py
Browse files- Scripts/mainpaperspaceA1111.py +16 -84
Scripts/mainpaperspaceA1111.py
CHANGED
@@ -227,97 +227,29 @@ def CN(ControlNet_Model, ControlNet_v2_Model):
|
|
227 |
|
228 |
|
229 |
|
230 |
-
def
|
231 |
|
232 |
auth=f"--gradio-auth {User}:{Password}"
|
233 |
if User =="" or Password=="":
|
234 |
auth=""
|
235 |
-
|
236 |
-
if not os.path.exists('/usr/lib/node_modules/localtunnel'):
|
237 |
-
call('npm install -g localtunnel --silent', shell=True, stdout=open('/dev/null', 'w'))
|
238 |
-
clear_output()
|
239 |
-
|
240 |
-
|
241 |
-
share=''
|
242 |
-
call('wget -q -O /usr/local/lib/python3.9/dist-packages/gradio/blocks.py https://raw.githubusercontent.com/TheLastBen/fast-stable-diffusion/main/AUTOMATIC1111_files/blocks.py', shell=True)
|
243 |
-
|
244 |
-
if not Use_localtunnel:
|
245 |
-
share='--share'
|
246 |
-
|
247 |
-
else:
|
248 |
-
share=''
|
249 |
-
os.chdir('/notebooks')
|
250 |
-
call('nohup lt --port 7860 > srv.txt 2>&1 &', shell=True)
|
251 |
-
time.sleep(2)
|
252 |
-
call("grep -o 'https[^ ]*' /notebooks/srv.txt >srvr.txt", shell=True)
|
253 |
-
time.sleep(2)
|
254 |
-
srv= getoutput('cat /notebooks/srvr.txt')
|
255 |
-
|
256 |
-
for line in fileinput.input('/usr/local/lib/python3.9/dist-packages/gradio/blocks.py', inplace=True):
|
257 |
-
if line.strip().startswith('self.server_name ='):
|
258 |
-
line = f' self.server_name = "{srv[8:]}"\n'
|
259 |
-
if line.strip().startswith('self.server_port ='):
|
260 |
-
line = ' self.server_port = 443\n'
|
261 |
-
if line.strip().startswith('self.protocol = "https"'):
|
262 |
-
line = ' self.protocol = "https"\n'
|
263 |
-
if line.strip().startswith('if self.local_url.startswith("https") or self.is_colab'):
|
264 |
-
line = ''
|
265 |
-
if line.strip().startswith('else "http"'):
|
266 |
-
line = ''
|
267 |
-
sys.stdout.write(line)
|
268 |
-
|
269 |
-
call('rm srv.txt srvr.txt', shell=True)
|
270 |
-
|
271 |
-
os.chdir('/notebooks/sd/stable-diffusion-webui/modules')
|
272 |
-
call('wget -q -O paths.py https://raw.githubusercontent.com/TheLastBen/fast-stable-diffusion/main/AUTOMATIC1111_files/paths.py', shell=True)
|
273 |
-
call("sed -i 's@ui.create_ui().*@ui.create_ui();shared.demo.queue(concurrency_count=999999,status_update_rate=0.1)@' /notebooks/sd/stable-diffusion-webui/webui.py", shell=True)
|
274 |
-
call("sed -i 's@/content/gdrive/MyDrive/sd/stablediffusion@/notebooks/sd/stablediffusion@' /notebooks/sd/stable-diffusion-webui/modules/paths.py", shell=True)
|
275 |
-
call("sed -i 's@\"quicksettings\": OptionInfo(.*@\"quicksettings\": OptionInfo(\"sd_model_checkpoint, sd_vae, CLIP_stop_at_last_layers, inpainting_mask_weight, initial_noise_multiplier\", \"Quicksettings list\"),@' /notebooks/sd/stable-diffusion-webui/modules/shared.py", shell=True)
|
276 |
-
os.chdir('/notebooks/sd/stable-diffusion-webui')
|
277 |
-
clear_output()
|
278 |
|
279 |
-
|
280 |
-
if os.path.isfile(model):
|
281 |
-
mdlpth="--ckpt "+model
|
282 |
-
else:
|
283 |
-
mdlpth="--ckpt-dir "+model
|
284 |
-
|
285 |
-
|
286 |
-
configf="--disable-console-progressbars --no-half-vae --disable-safe-unpickle --api --no-download-sd-model --xformers --enable-insecure-extension-access --skip-version-check "+auth+" "+share+" "+mdlpth
|
287 |
-
|
288 |
-
return configf
|
289 |
|
290 |
-
|
291 |
-
|
292 |
-
def sdui(User, Password, Ngrok_token, model):
|
293 |
-
|
294 |
-
from pyngrok import ngrok, conf
|
295 |
-
|
296 |
-
auth=f"--gradio-auth {User}:{Password}"
|
297 |
-
if User =="" or Password=="":
|
298 |
-
auth=""
|
299 |
-
|
300 |
-
share=''
|
301 |
call('wget -q -O /usr/local/lib/python3.9/dist-packages/gradio/blocks.py https://raw.githubusercontent.com/TheLastBen/fast-stable-diffusion/main/AUTOMATIC1111_files/blocks.py', shell=True)
|
302 |
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
else:
|
319 |
-
share='--share'
|
320 |
-
|
321 |
os.chdir('/notebooks/sd/stable-diffusion-webui/modules')
|
322 |
call('wget -q -O paths.py https://raw.githubusercontent.com/TheLastBen/fast-stable-diffusion/main/AUTOMATIC1111_files/paths.py', shell=True)
|
323 |
call("sed -i 's@ui.create_ui().*@ui.create_ui();shared.demo.queue(concurrency_count=999999,status_update_rate=0.1)@' /notebooks/sd/stable-diffusion-webui/webui.py", shell=True)
|
@@ -336,7 +268,7 @@ def sdui(User, Password, Ngrok_token, model):
|
|
336 |
mdlpth="--ckpt-dir "+model
|
337 |
|
338 |
|
339 |
-
configf="--disable-console-progressbars --no-half-vae --disable-safe-unpickle --api --no-download-sd-model --xformers --enable-insecure-extension-access --skip-version-check "+auth+" "+
|
340 |
|
341 |
return configf
|
342 |
|
|
|
227 |
|
228 |
|
229 |
|
230 |
+
def sdui(User, Password, model):
|
231 |
|
232 |
auth=f"--gradio-auth {User}:{Password}"
|
233 |
if User =="" or Password=="":
|
234 |
auth=""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
call('wget -q -O /usr/local/lib/python3.9/dist-packages/gradio/blocks.py https://raw.githubusercontent.com/TheLastBen/fast-stable-diffusion/main/AUTOMATIC1111_files/blocks.py', shell=True)
|
238 |
|
239 |
+
localurl="tensorboard-"+os.environ.get('PAPERSPACE_FQDN')
|
240 |
+
|
241 |
+
for line in fileinput.input('/usr/local/lib/python3.9/dist-packages/gradio/blocks.py', inplace=True):
|
242 |
+
if line.strip().startswith('self.server_name ='):
|
243 |
+
line = f' self.server_name = "{localurl}"\n'
|
244 |
+
if line.strip().startswith('self.protocol = "https"'):
|
245 |
+
line = ' self.protocol = "https"\n'
|
246 |
+
if line.strip().startswith('if self.local_url.startswith("https") or self.is_colab'):
|
247 |
+
line = ''
|
248 |
+
if line.strip().startswith('else "http"'):
|
249 |
+
line = ''
|
250 |
+
sys.stdout.write(line)
|
251 |
+
|
252 |
+
|
|
|
|
|
|
|
|
|
253 |
os.chdir('/notebooks/sd/stable-diffusion-webui/modules')
|
254 |
call('wget -q -O paths.py https://raw.githubusercontent.com/TheLastBen/fast-stable-diffusion/main/AUTOMATIC1111_files/paths.py', shell=True)
|
255 |
call("sed -i 's@ui.create_ui().*@ui.create_ui();shared.demo.queue(concurrency_count=999999,status_update_rate=0.1)@' /notebooks/sd/stable-diffusion-webui/webui.py", shell=True)
|
|
|
268 |
mdlpth="--ckpt-dir "+model
|
269 |
|
270 |
|
271 |
+
configf="--disable-console-progressbars --no-half-vae --disable-safe-unpickle --api --no-download-sd-model --xformers --enable-insecure-extension-access --skip-version-check "+auth+" "+mdlpth
|
272 |
|
273 |
return configf
|
274 |
|