parser.add_argument("--medvram",action='store_true',help="enable stable diffusion model optimizations for sacrificing a little speed for low VRM usage")
parser.add_argument("--medvram",action='store_true',help="enable stable diffusion model optimizations for sacrificing a little speed for low VRM usage")
parser.add_argument("--lowvram",action='store_true',help="enable stable diffusion model optimizations for sacrificing a lot of speed for very low VRM usage")
parser.add_argument("--lowvram",action='store_true',help="enable stable diffusion model optimizations for sacrificing a lot of speed for very low VRM usage")
parser.add_argument("--always-batch-cond-uncond",action='store_true',help="a workaround test; may help with speed if you use --lowvram")
parser.add_argument("--always-batch-cond-uncond",action='store_true',help="a workaround test; may help with speed if you use --lowvram")
parser.add_argument("--unload-gfpgan",action='store_true',help="unload GFPGAN every time after processing images. Warning: seems to cause memory leaks")
parser.add_argument("--unload-gfpgan",action='store_true',help="does not do anything.")
parser.add_argument("--precision",type=str,help="evaluate at this precision",choices=["full","autocast"],default="autocast")
parser.add_argument("--precision",type=str,help="evaluate at this precision",choices=["full","autocast"],default="autocast")
parser.add_argument("--share",action='store_true',help="use share=True for gradio and make the UI accessible through their site (doesn't work for me but you might have better luck)")
parser.add_argument("--share",action='store_true',help="use share=True for gradio and make the UI accessible through their site (doesn't work for me but you might have better luck)")
parser.add_argument("--esrgan-models-path",type=str,help="path to directory with ESRGAN models",default=os.path.join(script_path,'ESRGAN'))
parser.add_argument("--esrgan-models-path",type=str,help="path to directory with ESRGAN models",default=os.path.join(script_path,'ESRGAN'))
switch_mode=gr.Radio(label='Mode',elem_id="img2img_mode",choices=['Redraw whole image','Inpaint a part of image','Loopback','SD upscale'],value='Redraw whole image',type="index",show_label=False)
switch_mode=gr.Radio(label='Mode',elem_id="img2img_mode",choices=['Redraw whole image','Inpaint a part of image','Loopback','SD upscale'],value='Redraw whole image',type="index",show_label=False)
init_img=gr.Image(label="Image for img2img",source="upload",interactive=True,type="pil")
init_img=gr.Image(label="Image for img2img",source="upload",interactive=True,type="pil")
init_img_with_mask=gr.Image(label="Image for inpainting with mask",elem_id="img2maskimg",source="upload",interactive=True,type="pil",tool="sketch",visible=False,image_mode="RGBA")
init_img_with_mask=gr.Image(label="Image for inpainting with mask",elem_id="img2maskimg",source="upload",interactive=True,type="pil",tool="sketch",visible=False,image_mode="RGBA")
init_img_with_mask_comment=gr.HTML(elem_id="mask_bug_info",value="<small>if the editor shows ERROR, switch to another tab and back, then to another img2img mode above and back</small>",visible=False)
init_img_with_mask_comment=gr.HTML(elem_id="mask_bug_info",value="<small>if the editor shows ERROR, switch to another tab and back, then to another img2img mode above and back</small>",visible=False)
withgr.Row():
withgr.Row():
resize_mode=gr.Radio(label="Resize mode",elem_id="resize_mode",show_label=False,choices=["Just resize","Crop and resize","Resize and fill"],type="index",value="Just resize")
resize_mode=gr.Radio(label="Resize mode",elem_id="resize_mode",show_label=False,choices=["Just resize","Crop and resize","Resize and fill"],type="index",value="Just resize")