pseudotheos
commited on
Commit
•
acdd046
1
Parent(s):
e52fd17
Update app.py
Browse files
app.py
CHANGED
@@ -240,14 +240,12 @@ async def generate_image(
|
|
240 |
|
241 |
# Call existing inference function with the provided parameters
|
242 |
generated_image, _, _, _ = inference(control_image, prompt, "", guidance_scale, controlnet_scale, 0, controlnet_end, upscaler_strength, seed, sampler_type)
|
|
|
|
|
243 |
|
244 |
-
# Convert the PIL Image to bytes
|
245 |
-
img_bytes = io.BytesIO()
|
246 |
-
generated_image.save(img_bytes, format='PNG')
|
247 |
-
img_bytes.seek(0)
|
248 |
|
249 |
-
|
250 |
-
return
|
251 |
|
252 |
except Exception as e:
|
253 |
# Handle exceptions and return an error message if something goes wrong
|
|
|
240 |
|
241 |
# Call existing inference function with the provided parameters
|
242 |
generated_image, _, _, _ = inference(control_image, prompt, "", guidance_scale, controlnet_scale, 0, controlnet_end, upscaler_strength, seed, sampler_type)
|
243 |
+
if generated_image is None:
|
244 |
+
return "Failed to generate image"
|
245 |
|
|
|
|
|
|
|
|
|
246 |
|
247 |
+
logger.debug("Generated Image Size: %s", generated_image.size)
|
248 |
+
return generated_image
|
249 |
|
250 |
except Exception as e:
|
251 |
# Handle exceptions and return an error message if something goes wrong
|