Spaces:
Running
Running
stlaurentjr
commited on
Commit
•
bc928e4
1
Parent(s):
dba5f80
Update scripts/mainrunpodA1111.py
Browse files- 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 |
-
|
295 |
-
|
296 |
-
if LoRA_LINK=='':
|
297 |
-
print('[1;33mNothing to do')
|
298 |
else:
|
299 |
-
os.makedirs(
|
300 |
|
301 |
-
src=getsrc(LoRA_LINK)
|
302 |
|
303 |
-
if src==
|
304 |
-
modelname=get_name(LoRA_LINK, False)
|
305 |
-
loramodel=f
|
306 |
if not os.path.exists(loramodel):
|
307 |
-
|
308 |
-
|
309 |
else:
|
310 |
-
|
311 |
-
elif src==
|
312 |
-
modelname=
|
313 |
-
loramodel=f
|
314 |
if not os.path.exists(loramodel):
|
315 |
-
|
316 |
-
|
|
|
|
|
|
|
|
|
317 |
else:
|
318 |
-
|
319 |
else:
|
320 |
-
modelname=os.path.basename(LoRA_LINK)
|
321 |
-
loramodel=f
|
322 |
if not os.path.exists(loramodel):
|
323 |
-
|
324 |
-
|
325 |
else:
|
326 |
-
|
327 |
|
328 |
-
if os.path.exists(loramodel)
|
329 |
-
|
330 |
else:
|
331 |
-
|
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):
|