Update app.py
Browse files
app.py
CHANGED
|
@@ -48,12 +48,22 @@ async def gen(prompt, basemodel, width, height, scales, steps, seed, upscale_fac
|
|
| 48 |
return [None, None]
|
| 49 |
|
| 50 |
image_path = "temp_image.jpg"
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
if process_upscale:
|
| 54 |
upscale_image = get_upscale_finegrain(prompt, image_path, upscale_factor)
|
|
|
|
|
|
|
| 55 |
upscale_image_path = "upscale_image.jpg"
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
return [image_path, upscale_image_path]
|
| 58 |
else:
|
| 59 |
return [image_path, image_path]
|
|
|
|
| 48 |
return [None, None]
|
| 49 |
|
| 50 |
image_path = "temp_image.jpg"
|
| 51 |
+
try:
|
| 52 |
+
image.save(image_path, format="JPEG")
|
| 53 |
+
except Exception as e:
|
| 54 |
+
print(f"Error al guardar la imagen: {e}")
|
| 55 |
+
return [None, None]
|
| 56 |
|
| 57 |
if process_upscale:
|
| 58 |
upscale_image = get_upscale_finegrain(prompt, image_path, upscale_factor)
|
| 59 |
+
if upscale_image is None:
|
| 60 |
+
return [image_path, image_path]
|
| 61 |
upscale_image_path = "upscale_image.jpg"
|
| 62 |
+
try:
|
| 63 |
+
upscale_image.save(upscale_image_path, format="JPEG")
|
| 64 |
+
except Exception as e:
|
| 65 |
+
print(f"Error al guardar la imagen escalada: {e}")
|
| 66 |
+
return [image_path, image_path]
|
| 67 |
return [image_path, upscale_image_path]
|
| 68 |
else:
|
| 69 |
return [image_path, image_path]
|