Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -23,6 +23,7 @@ USE_TORCH_COMPILE = os.getenv("USE_TORCH_COMPILE") == "1"
|
|
23 |
ENABLE_CPU_OFFLOAD = os.getenv("ENABLE_CPU_OFFLOAD") == "1"
|
24 |
ENABLE_USE_LORA = os.getenv("ENABLE_USE_LORA", "1") == "1"
|
25 |
ENABLE_USE_VAE = os.getenv("ENABLE_USE_VAE", "1") == "1"
|
|
|
26 |
|
27 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
28 |
|
@@ -113,7 +114,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css="style.css") as demo:
|
|
113 |
model = gr.Text(label='Model', placeholder='e.g. stabilityai/stable-diffusion-xl-base-1.0')
|
114 |
vaecall = gr.Text(label='VAE', placeholder='e.g. madebyollin/sdxl-vae-fp16-fix')
|
115 |
lora = gr.Text(label='LoRA', placeholder='e.g. nerijs/pixel-art-xl')
|
116 |
-
url = gr.Text(label='URL', placeholder='URL
|
117 |
lora_scale = gr.Slider(
|
118 |
info="The closer to 1, the more it will resemble LoRA, but errors may be visible.",
|
119 |
label="Lora Scale",
|
@@ -122,7 +123,6 @@ with gr.Blocks(theme=gr.themes.Soft(), css="style.css") as demo:
|
|
122 |
step=0.01,
|
123 |
value=0.7,
|
124 |
)
|
125 |
-
use_url = gr.Image(label='Img2Img')
|
126 |
with gr.Row():
|
127 |
prompt = gr.Text(
|
128 |
placeholder="Input prompt",
|
@@ -135,6 +135,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css="style.css") as demo:
|
|
135 |
result = gr.Image(label="Result", show_label=False)
|
136 |
with gr.Accordion("Advanced options", open=False):
|
137 |
with gr.Row():
|
|
|
138 |
use_vae = gr.Checkbox(label='Use VAE', value=False, visible=ENABLE_USE_VAE)
|
139 |
use_lora = gr.Checkbox(label='Use Lora', value=False, visible=ENABLE_USE_LORA)
|
140 |
use_negative_prompt = gr.Checkbox(label="Use negative prompt", value=False)
|
@@ -245,9 +246,9 @@ with gr.Blocks(theme=gr.themes.Soft(), css="style.css") as demo:
|
|
245 |
queue=False,
|
246 |
api_name=False,
|
247 |
)
|
248 |
-
|
249 |
fn=lambda x: gr.update(visible=x),
|
250 |
-
inputs=
|
251 |
outputs=url,
|
252 |
queue=False,
|
253 |
api_name=False,
|
|
|
23 |
ENABLE_CPU_OFFLOAD = os.getenv("ENABLE_CPU_OFFLOAD") == "1"
|
24 |
ENABLE_USE_LORA = os.getenv("ENABLE_USE_LORA", "1") == "1"
|
25 |
ENABLE_USE_VAE = os.getenv("ENABLE_USE_VAE", "1") == "1"
|
26 |
+
ENABLE_USE_IMG2IMG = os.getenv("ENABLE_USE_VAE", "1") == "1"
|
27 |
|
28 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
29 |
|
|
|
114 |
model = gr.Text(label='Model', placeholder='e.g. stabilityai/stable-diffusion-xl-base-1.0')
|
115 |
vaecall = gr.Text(label='VAE', placeholder='e.g. madebyollin/sdxl-vae-fp16-fix')
|
116 |
lora = gr.Text(label='LoRA', placeholder='e.g. nerijs/pixel-art-xl')
|
117 |
+
url = gr.Text(label='URL', placeholder='URL')
|
118 |
lora_scale = gr.Slider(
|
119 |
info="The closer to 1, the more it will resemble LoRA, but errors may be visible.",
|
120 |
label="Lora Scale",
|
|
|
123 |
step=0.01,
|
124 |
value=0.7,
|
125 |
)
|
|
|
126 |
with gr.Row():
|
127 |
prompt = gr.Text(
|
128 |
placeholder="Input prompt",
|
|
|
135 |
result = gr.Image(label="Result", show_label=False)
|
136 |
with gr.Accordion("Advanced options", open=False):
|
137 |
with gr.Row():
|
138 |
+
use_img2img = gr.Checkbox(label='Use Img2Img', value=False, visible=ENABLE_USE_IMG2IMG)
|
139 |
use_vae = gr.Checkbox(label='Use VAE', value=False, visible=ENABLE_USE_VAE)
|
140 |
use_lora = gr.Checkbox(label='Use Lora', value=False, visible=ENABLE_USE_LORA)
|
141 |
use_negative_prompt = gr.Checkbox(label="Use negative prompt", value=False)
|
|
|
246 |
queue=False,
|
247 |
api_name=False,
|
248 |
)
|
249 |
+
use_img2img.change(
|
250 |
fn=lambda x: gr.update(visible=x),
|
251 |
+
inputs=use_img2img,
|
252 |
outputs=url,
|
253 |
queue=False,
|
254 |
api_name=False,
|