Add custom vae dropdown in webui (#1314)

This commit is contained in:
jinchen62
2023-04-18 17:24:02 -07:00
committed by GitHub
parent 1afe07c296
commit 747ed383b1
8 changed files with 65 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ def inpaint_inf(
scheduler: str,
custom_model: str,
hf_model_id: str,
custom_vae: str,
precision: str,
device: str,
max_length: int,
@@ -79,6 +80,7 @@ def inpaint_inf(
args.ckpt_loc = get_custom_model_pathfile(custom_model)
else:
args.hf_model_id = custom_model
args.custom_vae = custom_vae
args.use_lora = get_custom_vae_or_lora_weights(
lora_weights, lora_hf_id, "lora"

View File

@@ -40,6 +40,7 @@ def outpaint_inf(
scheduler: str,
custom_model: str,
hf_model_id: str,
custom_vae: str,
precision: str,
device: str,
max_length: int,
@@ -81,6 +82,7 @@ def outpaint_inf(
args.ckpt_loc = get_custom_model_pathfile(custom_model)
else:
args.hf_model_id = custom_model
args.custom_vae = custom_vae
args.use_lora = get_custom_vae_or_lora_weights(
lora_weights, lora_hf_id, "lora"

View File

@@ -35,6 +35,7 @@ def upscaler_inf(
scheduler: str,
custom_model: str,
hf_model_id: str,
custom_vae: str,
precision: str,
device: str,
max_length: int,
@@ -77,6 +78,7 @@ def upscaler_inf(
args.ckpt_loc = get_custom_model_pathfile(custom_model)
else:
args.hf_model_id = custom_model
args.custom_vae = custom_vae
args.save_metadata_to_json = save_metadata_to_json
args.write_metadata_to_png = save_metadata_to_png

View File

@@ -54,6 +54,7 @@ def img2img_inf(
scheduler: str,
custom_model: str,
hf_model_id: str,
custom_vae: str,
precision: str,
device: str,
max_length: int,
@@ -102,6 +103,7 @@ def img2img_inf(
args.ckpt_loc = get_custom_model_pathfile(custom_model)
else:
args.hf_model_id = custom_model
args.custom_vae = custom_vae
args.use_lora = get_custom_vae_or_lora_weights(
lora_weights, lora_hf_id, "lora"
@@ -351,6 +353,16 @@ with gr.Blocks(title="Image-to-Image") as img2img_web:
label="HuggingFace Model ID",
lines=3,
)
custom_vae = gr.Dropdown(
label=f"Custom Vae Models",
elem_id="custom_model",
value=os.path.basename(args.custom_vae)
if args.custom_vae
else "None",
choices=["None"]
+ get_custom_model_files()
+ predefined_models,
)
with gr.Group(elem_id="prompt_box_outer"):
prompt = gr.Textbox(
@@ -548,6 +560,7 @@ with gr.Blocks(title="Image-to-Image") as img2img_web:
scheduler,
custom_model,
hf_model_id,
custom_vae,
precision,
device,
max_length,

View File

@@ -47,6 +47,16 @@ with gr.Blocks(title="Inpainting") as inpaint_web:
label="HuggingFace Model ID",
lines=3,
)
custom_vae = gr.Dropdown(
label=f"Custom Vae Models",
elem_id="custom_model",
value=os.path.basename(args.custom_vae)
if args.custom_vae
else "None",
choices=["None"]
+ get_custom_model_files()
+ predefined_paint_models,
)
with gr.Group(elem_id="prompt_box_outer"):
prompt = gr.Textbox(
@@ -247,6 +257,7 @@ with gr.Blocks(title="Inpainting") as inpaint_web:
scheduler,
custom_model,
hf_model_id,
custom_vae,
precision,
device,
max_length,

View File

@@ -47,6 +47,16 @@ with gr.Blocks(title="Outpainting") as outpaint_web:
label="HuggingFace Model ID",
lines=3,
)
custom_vae = gr.Dropdown(
label=f"Custom Vae Models",
elem_id="custom_model",
value=os.path.basename(args.custom_vae)
if args.custom_vae
else "None",
choices=["None"]
+ get_custom_model_files()
+ predefined_paint_models,
)
with gr.Group(elem_id="prompt_box_outer"):
prompt = gr.Textbox(
@@ -267,6 +277,7 @@ with gr.Blocks(title="Outpainting") as outpaint_web:
scheduler,
custom_model,
hf_model_id,
custom_vae,
precision,
device,
max_length,

View File

@@ -44,6 +44,7 @@ def txt2img_inf(
scheduler: str,
custom_model: str,
hf_model_id: str,
custom_vae: str,
precision: str,
device: str,
max_length: int,
@@ -84,6 +85,7 @@ def txt2img_inf(
args.ckpt_loc = get_custom_model_pathfile(custom_model)
else:
args.hf_model_id = custom_model
args.custom_vae = custom_vae
args.save_metadata_to_json = save_metadata_to_json
args.write_metadata_to_png = save_metadata_to_png
@@ -229,6 +231,16 @@ with gr.Blocks(title="Text-to-Image") as txt2img_web:
label="HuggingFace Model ID",
lines=3,
)
custom_vae = gr.Dropdown(
label=f"Custom Vae Models",
elem_id="custom_model",
value=os.path.basename(args.custom_vae)
if args.custom_vae
else "None",
choices=["None"]
+ get_custom_model_files()
+ predefined_models,
)
with gr.Column(scale=1, min_width=170):
png_info_img = gr.Image(
label="Import PNG info",
@@ -428,6 +440,7 @@ with gr.Blocks(title="Text-to-Image") as txt2img_web:
scheduler,
custom_model,
hf_model_id,
custom_vae,
precision,
device,
max_length,

View File

@@ -46,6 +46,16 @@ with gr.Blocks(title="Upscaler") as upscaler_web:
label="HuggingFace Model ID",
lines=3,
)
custom_vae = gr.Dropdown(
label=f"Custom Vae Models",
elem_id="custom_model",
value=os.path.basename(args.custom_vae)
if args.custom_vae
else "None",
choices=["None"]
+ get_custom_model_files()
+ predefined_upscaler_models,
)
with gr.Group(elem_id="prompt_box_outer"):
prompt = gr.Textbox(
@@ -241,6 +251,7 @@ with gr.Blocks(title="Upscaler") as upscaler_web:
scheduler,
custom_model,
hf_model_id,
custom_vae,
precision,
device,
max_length,