stlaurentjr commited on
Commit
dba5f80
1 Parent(s): 8ca52ce

Update scripts/mainrunpodA1111.py

Browse files
Files changed (1) hide show
  1. scripts/mainrunpodA1111.py +47 -0
scripts/mainrunpodA1111.py CHANGED
@@ -240,7 +240,54 @@ def mdl(Original_Model_Version, Path_to_MODEL, MODEL_LINK):
240
  model="/workspace/sd/stable-diffusion-webui/models/Stable-diffusion"
241
 
242
  return model
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
 
 
 
 
 
244
 
245
  def loradwn(LoRA_LINK):
246
 
 
240
  model="/workspace/sd/stable-diffusion-webui/models/Stable-diffusion"
241
 
242
  return model
243
+
244
+ def modeldwn(model_LINK):
245
+
246
+ if model_LINK == "":
247
+ print("[1;33mNothing to do")
248
+ else:
249
+ os.makedirs(
250
+ "/workspace/sd/stable-diffusion-webui/models/Stable-diffusion",
251
+ exist_ok=True,
252
+ )
253
+
254
+ src = getsrc(model_LINK)
255
+
256
+ if src == "civitai":
257
+ modelname = get_name(model_LINK, False)
258
+ loramodel = f"/workspace/sd/stable-diffusion-webui/models/Stable-diffusion/{modelname}"
259
+ if not os.path.exists(loramodel):
260
+ dwn(model_LINK, loramodel, "Downloading the LoRA model")
261
+ clear_output()
262
+ else:
263
+ print("[1;33mModel already exists")
264
+ elif src == "gdrive":
265
+ modelname = get_true_name(model_LINK)
266
+ loramodel = f"/workspace/sd/stable-diffusion-webui/models/Stable-diffusion/{modelname}"
267
+ if not os.path.exists(loramodel):
268
+ gdown.download(
269
+ url=model_LINK.replace("/file/d/", "/uc?id=").replace("/view", ""),
270
+ output=loramodel,
271
+ quiet=False,
272
+ )
273
+ clear_output()
274
+ else:
275
+ print("[1;33mModel already exists")
276
+ else:
277
+ modelname = os.path.basename(model_LINK)
278
+ loramodel = f"/workspace/sd/stable-diffusion-webui/models/Stable-diffusion/{modelname}"
279
+ if not os.path.exists(loramodel):
280
+ gdown.download(
281
+ url=model_LINK, output=loramodel, quiet=False, fuzzy=True
282
+ )
283
+ clear_output()
284
+ else:
285
+ print("[1;33mModel already exists")
286
 
287
+ if os.path.exists(loramodel):
288
+ print("[1;32mCheckpoints downloaded")
289
+ else:
290
+ print("[1;31mWrong link, check that the link is valid")
291
 
292
  def loradwn(LoRA_LINK):
293