stlaurentjr commited on
Commit
bc928e4
1 Parent(s): dba5f80

Update scripts/mainrunpodA1111.py

Browse files
Files changed (1) hide show
  1. scripts/mainrunpodA1111.py +28 -26
scripts/mainrunpodA1111.py CHANGED
@@ -291,44 +291,46 @@ def modeldwn(model_LINK):
291
 
292
  def loradwn(LoRA_LINK):
293
 
294
- import gdown
295
-
296
- if LoRA_LINK=='':
297
- print('Nothing to do')
298
  else:
299
- os.makedirs('/workspace/sd/stable-diffusion-webui/models/Lora', exist_ok=True)
300
 
301
- src=getsrc(LoRA_LINK)
302
 
303
- if src=='civitai':
304
- modelname=get_name(LoRA_LINK, False)
305
- loramodel=f'/workspace/sd/stable-diffusion-webui/models/Lora/{modelname}'
306
  if not os.path.exists(loramodel):
307
- dwn(LoRA_LINK, loramodel, 'Downloading the LoRA model')
308
- clear_output()
309
  else:
310
- print('Model already exists')
311
- elif src=='gdrive':
312
- modelname=get_name(LoRA_LINK, True)
313
- loramodel=f'/workspace/sd/stable-diffusion-webui/models/Lora/{modelname}'
314
  if not os.path.exists(loramodel):
315
- gdown.download(url=LoRA_LINK, output=loramodel, quiet=False, fuzzy=True)
316
- clear_output()
 
 
 
 
317
  else:
318
- print('Model already exists')
319
  else:
320
- modelname=os.path.basename(LoRA_LINK)
321
- loramodel=f'/workspace/sd/stable-diffusion-webui/models/Lora/{modelname}'
322
  if not os.path.exists(loramodel):
323
- gdown.download(url=LoRA_LINK, output=loramodel, quiet=False, fuzzy=True)
324
- clear_output()
325
  else:
326
- print('Model already exists')
327
 
328
- if os.path.exists(loramodel) :
329
- print('LoRA downloaded')
330
  else:
331
- print('Wrong link, check that the link is valid')
332
 
333
  def CNet(ControlNet_Model, ControlNet_XL_Model):
334
  def download(url, model_dir):
 
291
 
292
  def loradwn(LoRA_LINK):
293
 
294
+ if LoRA_LINK == "":
295
+ print("[1;33mNothing to do")
 
 
296
  else:
297
+ os.makedirs("/workspace/sd/stable-diffusion-webui/models/Lora", exist_ok=True)
298
 
299
+ src = getsrc(LoRA_LINK)
300
 
301
+ if src == "civitai":
302
+ modelname = get_name(LoRA_LINK, False)
303
+ loramodel = f"/workspace/sd/stable-diffusion-webui/models/Lora/{modelname}"
304
  if not os.path.exists(loramodel):
305
+ dwn(LoRA_LINK, loramodel, "Downloading the LoRA model")
306
+ clear_output()
307
  else:
308
+ print("[1;33mModel already exists")
309
+ elif src == "gdrive":
310
+ modelname = get_true_name(LoRA_LINK)
311
+ loramodel = f"/workspace/sd/stable-diffusion-webui/models/Lora/{modelname}"
312
  if not os.path.exists(loramodel):
313
+ gdown.download(
314
+ url=LoRA_LINK.replace("/file/d/", "/uc?id=").replace("/view", ""),
315
+ output=loramodel,
316
+ quiet=False,
317
+ )
318
+ clear_output()
319
  else:
320
+ print("[1;33mModel already exists")
321
  else:
322
+ modelname = os.path.basename(LoRA_LINK)
323
+ loramodel = f"/workspace/sd/stable-diffusion-webui/models/Lora/{modelname}"
324
  if not os.path.exists(loramodel):
325
+ gdown.download(url=LoRA_LINK, output=loramodel, quiet=False, fuzzy=True)
326
+ clear_output()
327
  else:
328
+ print("[1;33mModel already exists")
329
 
330
+ if os.path.exists(loramodel):
331
+ print("[1;32mLoRA downloaded")
332
  else:
333
+ print("[1;31mWrong link, check that the link is valid")
334
 
335
  def CNet(ControlNet_Model, ControlNet_XL_Model):
336
  def download(url, model_dir):