mirror of
https://github.com/sd-webui/stable-diffusion-webui.git
synced 2024-12-14 14:52:31 +03:00
[updates] Image Tab (#433)
* added image lab * first release model loading/unloading and save procedure added, commented out unused code from frontend * bug fixes Changed the image output to a gallery to display multiple items Fixed results not showing up in output Fixed RealESRGAN 2x mode not working and hard coded the default value for the reload. * added GoBig model check * added LDSR load check * removed global statements, added model loader/unloader function * fixed optimized mode * update Co-authored-by: dr3amer <91037083+dr3am37@users.noreply.github.com> Co-authored-by: hlky <106811348+hlky@users.noreply.github.com>
This commit is contained in:
parent
72f1c29601
commit
a447938cde
@ -472,7 +472,7 @@ def draw_gradio_ui(opt, img2img=lambda x: x, txt2img=lambda x: x,imgproc=lambda
|
||||
output_txt2img_gallery,
|
||||
[realesrgan_source, tabs],
|
||||
_js=js_move_image('txt2img_gallery_output', 'img2img_editor'))
|
||||
"""
|
||||
"""
|
||||
gr.HTML("""
|
||||
<div id="90" style="max-width: 100%; font-size: 14px; text-align: center;" class="output-markdown gr-prose border-solid border border-gray-200 rounded gr-panel">
|
||||
<p>For help and advanced usage guides, visit the <a href="https://github.com/hlky/stable-diffusion-webui/wiki" target="_blank">Project Wiki</a></p>
|
||||
|
18
webui.py
18
webui.py
@ -408,6 +408,7 @@ def load_SD_model():
|
||||
model = model.half()
|
||||
modelCS = modelCS.half()
|
||||
modelFS = modelFS.half()
|
||||
return model,modelCS,modelFS,device, config
|
||||
else:
|
||||
config = OmegaConf.load(opt.config)
|
||||
model = load_model_from_config(config, opt.ckpt)
|
||||
@ -415,7 +416,11 @@ def load_SD_model():
|
||||
device = torch.device(f"cuda:{opt.gpu}") if torch.cuda.is_available() else torch.device("cpu")
|
||||
model = (model if opt.no_half else model.half()).to(device)
|
||||
return model, device,config
|
||||
model,device,config = load_SD_model()
|
||||
|
||||
if opt.optimized:
|
||||
model,modelCS,modelFS,device, config = load_SD_model()
|
||||
else:
|
||||
model, device,config = load_SD_model()
|
||||
|
||||
|
||||
def load_embeddings(fp):
|
||||
@ -1496,7 +1501,6 @@ def imgproc(image,image_batch,imgproc_prompt,imgproc_toggles, imgproc_upscale_to
|
||||
image = torch.from_numpy(image)
|
||||
|
||||
if opt.optimized:
|
||||
global modelFS
|
||||
modelFS.to(device)
|
||||
|
||||
init_image = 2. * image - 1.
|
||||
@ -1762,6 +1766,10 @@ def ModelLoader(models,load=False,unload=False):
|
||||
if m in global_vars:
|
||||
#if it is, delete it
|
||||
del global_vars[m]
|
||||
if opt.optimized:
|
||||
if m == 'model':
|
||||
del global_vars[m+'FS']
|
||||
del global_vars[m+'CS']
|
||||
if m =='model':
|
||||
m='Stable Diffusion'
|
||||
print('Unloaded ' + m)
|
||||
@ -1772,7 +1780,11 @@ def ModelLoader(models,load=False,unload=False):
|
||||
if m == 'GFPGAN':
|
||||
global_vars[m] = load_GFPGAN()
|
||||
elif m == 'model':
|
||||
global_vars[m] = load_SD_model()[0]
|
||||
sdLoader = load_SD_model()
|
||||
global_vars[m] = sdLoader[0]
|
||||
if opt.optimized:
|
||||
global_vars[m+'CS'] = sdLoader[1]
|
||||
global_vars[m+'FS'] = sdLoader[2]
|
||||
elif m == 'RealESRGAN':
|
||||
global_vars[m] = load_RealESRGAN('RealESRGAN_x4plus')
|
||||
elif m == 'LDSR':
|
||||
|
Loading…
Reference in New Issue
Block a user