Spaces:
Running
on
Zero
Running
on
Zero
refactor gui.py
Browse files
app.py
CHANGED
|
@@ -123,12 +123,12 @@ for url_embed in download_embeds:
|
|
| 123 |
)
|
| 124 |
|
| 125 |
# Build list models
|
| 126 |
-
embed_list = get_model_list(directory_embeds)
|
| 127 |
-
model_list = get_model_list(directory_models)
|
| 128 |
-
model_list = load_diffusers_format_model + model_list
|
| 129 |
-
lora_model_list = get_model_list(directory_loras)
|
| 130 |
lora_model_list.insert(0, "None")
|
| 131 |
-
vae_model_list = get_model_list(directory_vaes)
|
| 132 |
vae_model_list.insert(0, "None")
|
| 133 |
|
| 134 |
|
|
@@ -163,12 +163,7 @@ print('\033[33m🏁 Download and listing of valid models completed.\033[0m')
|
|
| 163 |
#######################
|
| 164 |
# GUI
|
| 165 |
#######################
|
| 166 |
-
import spaces
|
| 167 |
import gradio as gr
|
| 168 |
-
from PIL import Image
|
| 169 |
-
import IPython.display
|
| 170 |
-
import time, json
|
| 171 |
-
from IPython.utils import capture
|
| 172 |
import logging
|
| 173 |
from utils.string_utils import extract_parameters
|
| 174 |
from stablepy import logger
|
|
@@ -213,7 +208,14 @@ sdxl_task = [k for k, v in task_stablepy.items() if v in SDXL_TASKS]
|
|
| 213 |
sd_task = [k for k, v in task_stablepy.items() if v in SD15_TASKS]
|
| 214 |
|
| 215 |
|
| 216 |
-
def update_task_options(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
if model_name in model_list:
|
| 218 |
if "xl" in model_name.lower():
|
| 219 |
new_choices = sdxl_task
|
|
@@ -845,7 +847,6 @@ with gr.Blocks(css=CSS) as app:
|
|
| 845 |
"Detailfix",
|
| 846 |
open=False,
|
| 847 |
visible=True):
|
| 848 |
-
|
| 849 |
# Adetailer Inpaint Only
|
| 850 |
adetailer_inpaint_only_gui = gr.Checkbox(label="Inpaint only", value=True)
|
| 851 |
|
|
@@ -918,7 +919,10 @@ with gr.Blocks(css=CSS) as app:
|
|
| 918 |
open=False,
|
| 919 |
visible=True):
|
| 920 |
# Adetailer B
|
| 921 |
-
adetailer_active_b_gui = gr.Checkbox(
|
|
|
|
|
|
|
|
|
|
| 922 |
prompt_ad_b_gui = gr.Textbox(
|
| 923 |
label="Main prompt",
|
| 924 |
placeholder="Main prompt will be use",
|
|
@@ -1048,6 +1052,7 @@ with gr.Blocks(css=CSS) as app:
|
|
| 1048 |
try using sampler DPM++ 1s or DPM2 with Compel or Classic prompt weights.
|
| 1049 |
"""
|
| 1050 |
)
|
|
|
|
| 1051 |
gr.Markdown(
|
| 1052 |
"""### The following examples perform specific tasks:
|
| 1053 |
1. Generation with SDXL and upscale
|
|
@@ -1061,6 +1066,7 @@ with gr.Blocks(css=CSS) as app:
|
|
| 1061 |
to preserve a person's appearance or a specific style based on an image.
|
| 1062 |
"""
|
| 1063 |
)
|
|
|
|
| 1064 |
gr.Examples(
|
| 1065 |
examples=example_prompts,
|
| 1066 |
fn=sd_gen.generate_pipeline,
|
|
|
|
| 123 |
)
|
| 124 |
|
| 125 |
# Build list models
|
| 126 |
+
embed_list: list = get_model_list(directory_embeds)
|
| 127 |
+
model_list: list = get_model_list(directory_models)
|
| 128 |
+
model_list: list = load_diffusers_format_model + model_list
|
| 129 |
+
lora_model_list: list = get_model_list(directory_loras)
|
| 130 |
lora_model_list.insert(0, "None")
|
| 131 |
+
vae_model_list: list = get_model_list(directory_vaes)
|
| 132 |
vae_model_list.insert(0, "None")
|
| 133 |
|
| 134 |
|
|
|
|
| 163 |
#######################
|
| 164 |
# GUI
|
| 165 |
#######################
|
|
|
|
| 166 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
import logging
|
| 168 |
from utils.string_utils import extract_parameters
|
| 169 |
from stablepy import logger
|
|
|
|
| 208 |
sd_task = [k for k, v in task_stablepy.items() if v in SD15_TASKS]
|
| 209 |
|
| 210 |
|
| 211 |
+
def update_task_options(
|
| 212 |
+
model_name: str,
|
| 213 |
+
task_name: str):
|
| 214 |
+
"""
|
| 215 |
+
:param model_name:
|
| 216 |
+
:param task_name:
|
| 217 |
+
:return:
|
| 218 |
+
"""
|
| 219 |
if model_name in model_list:
|
| 220 |
if "xl" in model_name.lower():
|
| 221 |
new_choices = sdxl_task
|
|
|
|
| 847 |
"Detailfix",
|
| 848 |
open=False,
|
| 849 |
visible=True):
|
|
|
|
| 850 |
# Adetailer Inpaint Only
|
| 851 |
adetailer_inpaint_only_gui = gr.Checkbox(label="Inpaint only", value=True)
|
| 852 |
|
|
|
|
| 919 |
open=False,
|
| 920 |
visible=True):
|
| 921 |
# Adetailer B
|
| 922 |
+
adetailer_active_b_gui = gr.Checkbox(
|
| 923 |
+
label="Enable Adetailer B",
|
| 924 |
+
value=False
|
| 925 |
+
)
|
| 926 |
prompt_ad_b_gui = gr.Textbox(
|
| 927 |
label="Main prompt",
|
| 928 |
placeholder="Main prompt will be use",
|
|
|
|
| 1052 |
try using sampler DPM++ 1s or DPM2 with Compel or Classic prompt weights.
|
| 1053 |
"""
|
| 1054 |
)
|
| 1055 |
+
|
| 1056 |
gr.Markdown(
|
| 1057 |
"""### The following examples perform specific tasks:
|
| 1058 |
1. Generation with SDXL and upscale
|
|
|
|
| 1066 |
to preserve a person's appearance or a specific style based on an image.
|
| 1067 |
"""
|
| 1068 |
)
|
| 1069 |
+
|
| 1070 |
gr.Examples(
|
| 1071 |
examples=example_prompts,
|
| 1072 |
fn=sd_gen.generate_pipeline,
|
gui.py
CHANGED
|
@@ -4,7 +4,6 @@ from stablepy import Model_Diffusers
|
|
| 4 |
import torch
|
| 5 |
import logging
|
| 6 |
import random
|
| 7 |
-
import spaces
|
| 8 |
import gradio as gr
|
| 9 |
|
| 10 |
from models.upscaler import upscaler_dict_gui
|
|
|
|
| 4 |
import torch
|
| 5 |
import logging
|
| 6 |
import random
|
|
|
|
| 7 |
import gradio as gr
|
| 8 |
|
| 9 |
from models.upscaler import upscaler_dict_gui
|