Spaces:
Runtime error
Runtime error
Update inference output in app.py to yield Gradio updates instead of images, streamlining the generator's response structure for improved integration with the UI.
Browse files
app.py
CHANGED
|
@@ -150,7 +150,7 @@ def infer(
|
|
| 150 |
num_images_per_prompt=1,
|
| 151 |
).images
|
| 152 |
stage2_only_image = stage2_images[0] if stage2_images else None
|
| 153 |
-
yield stage2_only_image,
|
| 154 |
|
| 155 |
# --- Combined generation ---
|
| 156 |
print(f"Generating with combined LoRAs...")
|
|
@@ -180,11 +180,11 @@ def infer(
|
|
| 180 |
if pil_image.size != generated_image.size:
|
| 181 |
pil_image = pil_image.resize(generated_image.size, Image.Resampling.LANCZOS)
|
| 182 |
blended_image = Image.blend(pil_image, generated_image, alpha=0.75)
|
| 183 |
-
yield
|
| 184 |
return
|
| 185 |
|
| 186 |
# Return first result image and seed
|
| 187 |
-
yield
|
| 188 |
|
| 189 |
# --- Examples and UI Layout ---
|
| 190 |
examples = []
|
|
|
|
| 150 |
num_images_per_prompt=1,
|
| 151 |
).images
|
| 152 |
stage2_only_image = stage2_images[0] if stage2_images else None
|
| 153 |
+
yield stage2_only_image, None, seed
|
| 154 |
|
| 155 |
# --- Combined generation ---
|
| 156 |
print(f"Generating with combined LoRAs...")
|
|
|
|
| 180 |
if pil_image.size != generated_image.size:
|
| 181 |
pil_image = pil_image.resize(generated_image.size, Image.Resampling.LANCZOS)
|
| 182 |
blended_image = Image.blend(pil_image, generated_image, alpha=0.75)
|
| 183 |
+
yield gr.update(), blended_image, seed
|
| 184 |
return
|
| 185 |
|
| 186 |
# Return first result image and seed
|
| 187 |
+
yield gr.update(), result_images[0] if result_images else None, seed
|
| 188 |
|
| 189 |
# --- Examples and UI Layout ---
|
| 190 |
examples = []
|