new stable diffusion

This commit is contained in:
Saifeddine ALOUI 2024-03-04 23:35:37 +01:00
parent a68d663e2e
commit b643ad2860
2 changed files with 11 additions and 1 deletions

View File

@ -44,4 +44,5 @@ def install_sd():
return {"status":True}
except Exception as ex:
lollmsElfServer.HideBlockingMessage()
lollmsElfServer.InfoMessage(f"It looks like I could not install SD because of this error:\n{ex}\nThis is commonly caused by a previous version that I couldn't delete. PLease remove {lollmsElfServer.lollms_paths.personal_path}/shared/auto_sd manually then try again")
return {"status":False, 'error':str(ex)}

View File

@ -31,6 +31,7 @@ from lollms.paths import LollmsPaths
from lollms.utilities import git_pull, show_yes_no_dialog
import subprocess
import shutil
from tqdm import tqdm
def verify_sd(lollms_paths:LollmsPaths):
@ -41,11 +42,19 @@ def verify_sd(lollms_paths:LollmsPaths):
return sd_folder.exists()
def download_file(url, folder_path, local_filename):
# Make sure 'folder_path' exists
folder_path.mkdir(parents=True, exist_ok=True)
with requests.get(url, stream=True) as r:
r.raise_for_status()
with open(folder_path + '/' + local_filename, 'wb') as f:
total_size = int(r.headers.get('content-length', 0))
progress_bar = tqdm(total=total_size, unit='B', unit_scale=True)
with open(folder_path / local_filename, 'wb') as f:
for chunk in r.iter_content(chunk_size=8192):
f.write(chunk)
progress_bar.update(len(chunk))
progress_bar.close()
return local_filename
def install_sd(lollms_app:LollmsApplication):