mirror of
https://github.com/Sygil-Dev/sygil-webui.git
synced 2024-12-14 22:13:41 +03:00
parent
e66eddc621
commit
06df5a5697
1
.gitignore
vendored
1
.gitignore
vendored
@ -54,7 +54,6 @@ condaenv.*.requirements.txt
|
|||||||
/custom-conda-path.txt
|
/custom-conda-path.txt
|
||||||
/src/*
|
/src/*
|
||||||
/outputs/*
|
/outputs/*
|
||||||
/models/*
|
|
||||||
/log/**/*.png
|
/log/**/*.png
|
||||||
/log/log.csv
|
/log/log.csv
|
||||||
/flagged/*
|
/flagged/*
|
||||||
|
@ -33,9 +33,9 @@ dependencies:
|
|||||||
- facexlib>=0.2.3
|
- facexlib>=0.2.3
|
||||||
- python-slugify>=6.1.2
|
- python-slugify>=6.1.2
|
||||||
- streamlit>=1.12.2
|
- streamlit>=1.12.2
|
||||||
- -e git+https://github.com/CompVis/taming-transformers#egg=taming-transformers
|
- taming-transformers>=0.0.1
|
||||||
- -e git+https://github.com/openai/CLIP#egg=clip
|
- openai-clip>=1.0.1
|
||||||
- -e git+https://github.com/TencentARC/GFPGAN#egg=GFPGAN
|
- gfpgan>=1.3.5
|
||||||
- -e git+https://github.com/xinntao/Real-ESRGAN#egg=realesrgan
|
- realesrgan>=0.2.5.0
|
||||||
- -e git+https://github.com/hlky/k-diffusion-sd#egg=k_diffusion
|
- -e git+https://github.com/hlky/k-diffusion-sd#egg=k_diffusion
|
||||||
- -e .
|
- -e .
|
||||||
|
@ -161,11 +161,11 @@ def draw_gradio_ui(opt, img2img=lambda x: x, txt2img=lambda x: x,imgproc=lambda
|
|||||||
with gr.Tabs():
|
with gr.Tabs():
|
||||||
with gr.TabItem("Img2Img Input"):
|
with gr.TabItem("Img2Img Input"):
|
||||||
#gr.Markdown('#### Img2Img Input')
|
#gr.Markdown('#### Img2Img Input')
|
||||||
img2img_image_mask = gr.Image(value=sample_img2img, source="upload", interactive=False,
|
|
||||||
type="pil", tool="select", elem_id="img2img_editor",
|
|
||||||
image_mode="RGBA", visible=False)
|
|
||||||
img2img_image_editor = gr.Image(value=sample_img2img, source="upload", interactive=True,
|
img2img_image_editor = gr.Image(value=sample_img2img, source="upload", interactive=True,
|
||||||
type="pil", tool="sketch", visible=True,
|
type="pil", tool="select", elem_id="img2img_editor",
|
||||||
|
image_mode="RGBA")
|
||||||
|
img2img_image_mask = gr.Image(value=sample_img2img, source="upload", interactive=True,
|
||||||
|
type="pil", tool="sketch", visible=False,
|
||||||
elem_id="img2img_mask")
|
elem_id="img2img_mask")
|
||||||
|
|
||||||
with gr.TabItem("Img2Img Mask Input"):
|
with gr.TabItem("Img2Img Mask Input"):
|
||||||
@ -176,10 +176,10 @@ def draw_gradio_ui(opt, img2img=lambda x: x, txt2img=lambda x: x,imgproc=lambda
|
|||||||
with gr.TabItem("Editor Options"):
|
with gr.TabItem("Editor Options"):
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
img2img_image_editor_mode = gr.Radio(choices=["Mask", "Crop", "Uncrop"], label="Image Editor Mode",
|
img2img_image_editor_mode = gr.Radio(choices=["Mask", "Crop", "Uncrop"], label="Image Editor Mode",
|
||||||
value="Mask", elem_id='edit_mode_select', visible=False)
|
value="Crop", elem_id='edit_mode_select')
|
||||||
img2img_mask = gr.Radio(choices=["Keep masked area", "Regenerate only masked area"],
|
img2img_mask = gr.Radio(choices=["Keep masked area", "Regenerate only masked area", "Resize and regenerate only masked area"],
|
||||||
label="Mask Mode", type="index",
|
label="Mask Mode", type="index",
|
||||||
value=img2img_mask_modes[img2img_defaults['mask_mode']], visible=True)
|
value=img2img_mask_modes[img2img_defaults['mask_mode']], visible=False)
|
||||||
|
|
||||||
img2img_mask_blur_strength = gr.Slider(minimum=1, maximum=10, step=1,
|
img2img_mask_blur_strength = gr.Slider(minimum=1, maximum=10, step=1,
|
||||||
label="How much blurry should the mask be? (to avoid hard edges)",
|
label="How much blurry should the mask be? (to avoid hard edges)",
|
||||||
@ -188,7 +188,7 @@ def draw_gradio_ui(opt, img2img=lambda x: x, txt2img=lambda x: x,imgproc=lambda
|
|||||||
img2img_resize = gr.Radio(label="Resize mode",
|
img2img_resize = gr.Radio(label="Resize mode",
|
||||||
choices=["Just resize", "Crop and resize", "Resize and fill"],
|
choices=["Just resize", "Crop and resize", "Resize and fill"],
|
||||||
type="index",
|
type="index",
|
||||||
value=img2img_resize_modes[img2img_defaults['resize_mode']], visible=False)
|
value=img2img_resize_modes[img2img_defaults['resize_mode']])
|
||||||
|
|
||||||
img2img_painterro_btn = gr.Button("Advanced Editor")
|
img2img_painterro_btn = gr.Button("Advanced Editor")
|
||||||
with gr.TabItem("Hints"):
|
with gr.TabItem("Hints"):
|
||||||
@ -323,16 +323,16 @@ def draw_gradio_ui(opt, img2img=lambda x: x, txt2img=lambda x: x,imgproc=lambda
|
|||||||
|
|
||||||
def generate(*args):
|
def generate(*args):
|
||||||
args_list = list(args)
|
args_list = list(args)
|
||||||
init_info_mask = args_list[2]
|
init_info_mask = args_list[3]
|
||||||
# Get the mask input and remove it from the list
|
# Get the mask input and remove it from the list
|
||||||
mask_input = args_list[-1]
|
mask_input = args_list[18]
|
||||||
del args_list[-1]
|
del args_list[18]
|
||||||
|
|
||||||
# If an external mask is set, use it
|
# If an external mask is set, use it
|
||||||
if mask_input:
|
if mask_input:
|
||||||
init_info_mask['mask'] = mask_input
|
init_info_mask['mask'] = mask_input
|
||||||
|
|
||||||
args_list[2] = init_info_mask
|
args_list[3] = init_info_mask
|
||||||
|
|
||||||
# Return the result of img2img
|
# Return the result of img2img
|
||||||
return img2img_func(*args_list)
|
return img2img_func(*args_list)
|
||||||
|
@ -288,7 +288,7 @@ class JobManager:
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
outputs = job_info.func(*job_info.inputs)
|
outputs = job_info.func(*job_info.inputs, job_info=job_info)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
job_info.job_status = f"Error: {e}"
|
job_info.job_status = f"Error: {e}"
|
||||||
print(f"Exception processing job {job_info}: {e}\n{traceback.format_exc()}")
|
print(f"Exception processing job {job_info}: {e}\n{traceback.format_exc()}")
|
||||||
|
@ -1442,11 +1442,11 @@ def img2img(prompt: str, image_editor_mode: str, init_info: any, init_info_mask:
|
|||||||
|
|
||||||
if image_editor_mode == 'Mask':
|
if image_editor_mode == 'Mask':
|
||||||
global returned_info
|
global returned_info
|
||||||
init_img = init_info["image"]
|
init_img = init_info_mask["image"]
|
||||||
init_img = init_img.convert("RGB")
|
init_img = init_img.convert("RGB")
|
||||||
init_img = resize_image(resize_mode, init_img, width, height)
|
init_img = resize_image(resize_mode, init_img, width, height)
|
||||||
init_img = init_img.convert("RGB")
|
image = image.convert("RGB")
|
||||||
init_mask = init_info["mask"]
|
init_mask = init_info_mask["mask"]
|
||||||
init_mask = resize_image(resize_mode, init_mask, width, height)
|
init_mask = resize_image(resize_mode, init_mask, width, height)
|
||||||
resize_mask = mask_mode == 2
|
resize_mask = mask_mode == 2
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ IF "%CONDA_PATH%"=="" (
|
|||||||
:foundPath
|
:foundPath
|
||||||
call "%CONDA_PATH%\Scripts\activate.bat"
|
call "%CONDA_PATH%\Scripts\activate.bat"
|
||||||
call conda env create -n "%conda_env_name%" -f environment.yaml
|
call conda env create -n "%conda_env_name%" -f environment.yaml
|
||||||
|
call conda env update -n "%conda_env_name%" --file environment.yaml --prune
|
||||||
call "%CONDA_PATH%\Scripts\activate.bat" "%conda_env_name%"
|
call "%CONDA_PATH%\Scripts\activate.bat" "%conda_env_name%"
|
||||||
python "%CD%"\scripts\relauncher.py
|
python "%CD%"\scripts\relauncher.py
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user