Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -165,17 +165,18 @@ def inference(
|
|
165 |
bg_color: str = "white",
|
166 |
qr_color: str = "black",
|
167 |
invert_final_image: bool = False,
|
168 |
-
invert_init_image: bool = False,
|
169 |
controlnet_model: str = "QR Code Monster",
|
170 |
diffusion_model: str = "Stable Diffusion v1.5",
|
171 |
-
progress=gr.Progress()
|
172 |
):
|
173 |
try:
|
|
|
174 |
# Load models based on user selection
|
175 |
progress(0, desc="Downloading models...")
|
176 |
pipe = load_models(controlnet_model, diffusion_model)
|
177 |
progress(0.5, desc="Models downloaded, preparing for inference...")
|
178 |
|
|
|
179 |
if prompt is None or prompt == "":
|
180 |
raise gr.Error("Prompt is required")
|
181 |
|
@@ -245,7 +246,6 @@ def inference(
|
|
245 |
return final_image, seed
|
246 |
except Exception as e:
|
247 |
print(f"Error in inference: {str(e)}")
|
248 |
-
# Return a blank image and -1 as seed in case of an error
|
249 |
return Image.new('RGB', (768, 768), color='white'), -1
|
250 |
|
251 |
def invert_init_image_display(image):
|
@@ -531,7 +531,6 @@ with gr.Blocks(theme='Hev832/Applio') as blocks:
|
|
531 |
invert_init_image,
|
532 |
controlnet_model_dropdown,
|
533 |
diffusion_model_dropdown,
|
534 |
-
gr.Progress()
|
535 |
],
|
536 |
outputs=[result_image, used_seed],
|
537 |
concurrency_limit=20
|
|
|
165 |
bg_color: str = "white",
|
166 |
qr_color: str = "black",
|
167 |
invert_final_image: bool = False,
|
168 |
+
invert_init_image: bool = False,
|
169 |
controlnet_model: str = "QR Code Monster",
|
170 |
diffusion_model: str = "Stable Diffusion v1.5",
|
|
|
171 |
):
|
172 |
try:
|
173 |
+
progress = gr.Progress()
|
174 |
# Load models based on user selection
|
175 |
progress(0, desc="Downloading models...")
|
176 |
pipe = load_models(controlnet_model, diffusion_model)
|
177 |
progress(0.5, desc="Models downloaded, preparing for inference...")
|
178 |
|
179 |
+
|
180 |
if prompt is None or prompt == "":
|
181 |
raise gr.Error("Prompt is required")
|
182 |
|
|
|
246 |
return final_image, seed
|
247 |
except Exception as e:
|
248 |
print(f"Error in inference: {str(e)}")
|
|
|
249 |
return Image.new('RGB', (768, 768), color='white'), -1
|
250 |
|
251 |
def invert_init_image_display(image):
|
|
|
531 |
invert_init_image,
|
532 |
controlnet_model_dropdown,
|
533 |
diffusion_model_dropdown,
|
|
|
534 |
],
|
535 |
outputs=[result_image, used_seed],
|
536 |
concurrency_limit=20
|