Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -45,7 +45,7 @@ async def gen(prompt, basemodel, width, height, scales, steps, seed, upscale_fac
|
|
| 45 |
model = enable_lora(lora_model, basemodel) if process_lora else basemodel
|
| 46 |
image, seed = await generate_image(prompt, model, "", width, height, scales, steps, seed)
|
| 47 |
if image is None:
|
| 48 |
-
return [None, None
|
| 49 |
|
| 50 |
image_path = "temp_image.jpg"
|
| 51 |
image.save(image_path, format="JPEG")
|
|
@@ -55,12 +55,12 @@ async def gen(prompt, basemodel, width, height, scales, steps, seed, upscale_fac
|
|
| 55 |
if upscale_image_path is not None:
|
| 56 |
upscale_image = Image.open(upscale_image_path)
|
| 57 |
upscale_image.save("upscale_image.jpg", format="JPEG")
|
| 58 |
-
return [image_path, "upscale_image.jpg"
|
| 59 |
else:
|
| 60 |
print("Error: The scaled image path is None")
|
| 61 |
-
return [image_path, image_path
|
| 62 |
else:
|
| 63 |
-
return [image_path, image_path
|
| 64 |
|
| 65 |
css = """
|
| 66 |
#col-container{ margin: 0 auto; max-width: 1024px;}
|
|
@@ -87,6 +87,5 @@ with gr.Blocks(css=css) as demo:
|
|
| 87 |
seed = gr.Number(label="Seed", value=-1)
|
| 88 |
|
| 89 |
btn = gr.Button("Generate")
|
| 90 |
-
|
| 91 |
-
btn.click(fn=gen, inputs=[prompt, basemodel_choice, width, height, scales, steps, seed, upscale_factor, process_upscale, lora_model_choice, process_lora], outputs=[output_res, seed_output])
|
| 92 |
demo.launch()
|
|
|
|
| 45 |
model = enable_lora(lora_model, basemodel) if process_lora else basemodel
|
| 46 |
image, seed = await generate_image(prompt, model, "", width, height, scales, steps, seed)
|
| 47 |
if image is None:
|
| 48 |
+
return [None, None]
|
| 49 |
|
| 50 |
image_path = "temp_image.jpg"
|
| 51 |
image.save(image_path, format="JPEG")
|
|
|
|
| 55 |
if upscale_image_path is not None:
|
| 56 |
upscale_image = Image.open(upscale_image_path)
|
| 57 |
upscale_image.save("upscale_image.jpg", format="JPEG")
|
| 58 |
+
return [image_path, "upscale_image.jpg"]
|
| 59 |
else:
|
| 60 |
print("Error: The scaled image path is None")
|
| 61 |
+
return [image_path, image_path]
|
| 62 |
else:
|
| 63 |
+
return [image_path, image_path]
|
| 64 |
|
| 65 |
css = """
|
| 66 |
#col-container{ margin: 0 auto; max-width: 1024px;}
|
|
|
|
| 87 |
seed = gr.Number(label="Seed", value=-1)
|
| 88 |
|
| 89 |
btn = gr.Button("Generate")
|
| 90 |
+
btn.click(fn=gen, inputs=[prompt, basemodel_choice, width, height, scales, steps, seed, upscale_factor, process_upscale, lora_model_choice, process_lora], outputs=output_res,)
|
|
|
|
| 91 |
demo.launch()
|