TheLastBen commited on
Commit
d87155c
1 Parent(s): 79e12cf

Upload 4 files

Browse files
Files changed (1) hide show
  1. Scripts/sdxllorapps.py +19 -2
Scripts/sdxllorapps.py CHANGED
@@ -732,6 +732,8 @@ def sdcmf(MDLPTH, Download_SDXL_Model):
732
  if os.path.exists(MDLPTH):
733
  call('ln -s '+MDLPTH+' models/loras', shell=True, stdout=open('/dev/null', 'w'), stderr=open('/dev/null', 'w'))
734
 
 
 
735
  if not os.path.exists('models/checkpoints/sd_xl_base_1.0.safetensors'):
736
  call('ln -s /datasets/stable-diffusion-xl/sd_xl_base_1.0.safetensors models/checkpoints', shell=True)
737
 
@@ -768,7 +770,12 @@ def test(MDLPTH, User, Password):
768
  if not os.path.exists('models/Stable-diffusion/sd_xl_base_1.0.safetensors'):
769
  call('ln -s /datasets/stable-diffusion-xl/sd_xl_base_1.0.safetensors models/Stable-diffusion', shell=True)
770
 
771
-
 
 
 
 
 
772
  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)
773
 
774
  localurl="tensorboard-"+os.environ.get('PAPERSPACE_FQDN')
@@ -1101,4 +1108,14 @@ def crop_image(im, size):
1101
 
1102
  results.append(im.crop(tuple(crop)))
1103
 
1104
- return results
 
 
 
 
 
 
 
 
 
 
 
732
  if os.path.exists(MDLPTH):
733
  call('ln -s '+MDLPTH+' models/loras', shell=True, stdout=open('/dev/null', 'w'), stderr=open('/dev/null', 'w'))
734
 
735
+ clean_symlinks('models/loras')
736
+
737
  if not os.path.exists('models/checkpoints/sd_xl_base_1.0.safetensors'):
738
  call('ln -s /datasets/stable-diffusion-xl/sd_xl_base_1.0.safetensors models/checkpoints', shell=True)
739
 
 
770
  if not os.path.exists('models/Stable-diffusion/sd_xl_base_1.0.safetensors'):
771
  call('ln -s /datasets/stable-diffusion-xl/sd_xl_base_1.0.safetensors models/Stable-diffusion', shell=True)
772
 
773
+
774
+ if os.path.exists(MDLPTH):
775
+ call('ln -s '+MDLPTH+' models/Lora', shell=True, stdout=open('/dev/null', 'w'), stderr=open('/dev/null', 'w'))
776
+
777
+ clean_symlinks('models/Lora')
778
+
779
  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)
780
 
781
  localurl="tensorboard-"+os.environ.get('PAPERSPACE_FQDN')
 
1108
 
1109
  results.append(im.crop(tuple(crop)))
1110
 
1111
+ return results
1112
+
1113
+
1114
+
1115
+ def clean_symlinks(path):
1116
+ for item in os.listdir(path):
1117
+ lnk = os.path.join(path, item)
1118
+ if os.path.islink(lnk) and not os.path.exists(os.readlink(lnk)):
1119
+ os.remove(lnk)
1120
+
1121
+