Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -44,7 +44,7 @@ async def gen(prompt, basemodel, width, height, scales, steps, seed, upscale_fac
|
|
44 |
model = enable_lora(lora_model, basemodel) if process_lora else basemodel
|
45 |
image, seed = await generate_image(prompt, model, "", width, height, scales, steps, seed)
|
46 |
if image is None:
|
47 |
-
return [None, None]
|
48 |
|
49 |
image_path = "temp_image.jpg"
|
50 |
image.save(image_path, format="JPEG")
|
@@ -54,17 +54,14 @@ async def gen(prompt, basemodel, width, height, scales, steps, seed, upscale_fac
|
|
54 |
if upscale_image_path is not None:
|
55 |
upscale_image = Image.open(upscale_image_path)
|
56 |
upscale_image.save("upscale_image.jpg", format="JPEG")
|
57 |
-
return [image_path, "upscale_image.jpg"]
|
58 |
else:
|
59 |
print("Error: The scaled image path is None")
|
60 |
-
return [image_path, image_path]
|
61 |
else:
|
62 |
-
return [image_path, image_path]
|
63 |
-
|
64 |
-
css = """
|
65 |
-
#col-container{ margin: 0 auto; max-width: 1024px;}
|
66 |
-
"""
|
67 |
|
|
|
68 |
with gr.Blocks(css=css) as demo:
|
69 |
with gr.Column(elem_id="col-container"):
|
70 |
with gr.Row():
|
@@ -86,5 +83,10 @@ with gr.Blocks(css=css) as demo:
|
|
86 |
seed = gr.Number(label="Seed", value=-1)
|
87 |
|
88 |
btn = gr.Button("Generate")
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
44 |
model = enable_lora(lora_model, basemodel) if process_lora else basemodel
|
45 |
image, seed = await generate_image(prompt, model, "", width, height, scales, steps, seed)
|
46 |
if image is None:
|
47 |
+
return [None, None, None]
|
48 |
|
49 |
image_path = "temp_image.jpg"
|
50 |
image.save(image_path, format="JPEG")
|
|
|
54 |
if upscale_image_path is not None:
|
55 |
upscale_image = Image.open(upscale_image_path)
|
56 |
upscale_image.save("upscale_image.jpg", format="JPEG")
|
57 |
+
return [image_path, "upscale_image.jpg", seed]
|
58 |
else:
|
59 |
print("Error: The scaled image path is None")
|
60 |
+
return [image_path, image_path, seed]
|
61 |
else:
|
62 |
+
return [image_path, image_path, seed]
|
|
|
|
|
|
|
|
|
63 |
|
64 |
+
# Update the interface
|
65 |
with gr.Blocks(css=css) as demo:
|
66 |
with gr.Column(elem_id="col-container"):
|
67 |
with gr.Row():
|
|
|
83 |
seed = gr.Number(label="Seed", value=-1)
|
84 |
|
85 |
btn = gr.Button("Generate")
|
86 |
+
seed_output = gr.Textbox(label="Seed Value") # Added Textbox for Seed Output
|
87 |
+
btn.click(
|
88 |
+
fn=gen,
|
89 |
+
inputs=[prompt, basemodel_choice, width, height, scales, steps, seed, upscale_factor, process_upscale, lora_model_choice, process_lora],
|
90 |
+
outputs=[output_res, seed_output], # Updated outputs to include seed
|
91 |
+
)
|
92 |
+
demo.launch()
|