Update app.py
Browse files
app.py
CHANGED
|
@@ -73,14 +73,14 @@ def process(
|
|
| 73 |
):
|
| 74 |
if not input_text:
|
| 75 |
gr.Info("Please enter a text prompt.")
|
| 76 |
-
return None, None
|
| 77 |
input_text = "A military COR3 "+input_text
|
| 78 |
image = input_image_editor['background']
|
| 79 |
mask = input_image_editor['layers'][0]
|
| 80 |
|
| 81 |
if not image:
|
| 82 |
gr.Info("Please upload an image.")
|
| 83 |
-
return None, None
|
| 84 |
|
| 85 |
width, height = resize_image_dimensions(original_resolution_wh=image.size)
|
| 86 |
resized_image = image.resize((width, height), Image.LANCZOS)
|
|
@@ -96,14 +96,14 @@ def process(
|
|
| 96 |
image=resized_image,
|
| 97 |
width=width,
|
| 98 |
height=height,
|
| 99 |
-
num_images_per_prompt =
|
| 100 |
strength=strength_slider,
|
| 101 |
generator=generator,
|
| 102 |
joint_attention_kwargs={"scale": 1.2},
|
| 103 |
num_inference_steps=num_inference_steps_slider
|
| 104 |
)
|
| 105 |
print('INFERENCE DONE')
|
| 106 |
-
return result.images[0], result.images[1]
|
| 107 |
|
| 108 |
#resized_mask = mask.resize((width, height), Image.LANCZOS)
|
| 109 |
|
|
@@ -183,10 +183,7 @@ with gr.Blocks() as demo:
|
|
| 183 |
type='pil', image_mode='RGB', label='Generated image', format="png")
|
| 184 |
output_image_component2 = gr.Image(
|
| 185 |
type='pil', image_mode='RGB', label='Generated image', format="png")
|
| 186 |
-
|
| 187 |
-
type='pil', image_mode='RGB', label='Generated image', format="png")
|
| 188 |
-
output_image_component4 = gr.Image(
|
| 189 |
-
type='pil', image_mode='RGB', label='Generated image', format="png")
|
| 190 |
|
| 191 |
|
| 192 |
submit_button_component.click(
|
|
@@ -201,9 +198,7 @@ with gr.Blocks() as demo:
|
|
| 201 |
],
|
| 202 |
outputs=[
|
| 203 |
output_image_component,
|
| 204 |
-
output_image_component2
|
| 205 |
-
output_image_component3,
|
| 206 |
-
output_image_component4
|
| 207 |
]
|
| 208 |
)
|
| 209 |
|
|
|
|
| 73 |
):
|
| 74 |
if not input_text:
|
| 75 |
gr.Info("Please enter a text prompt.")
|
| 76 |
+
return None, None
|
| 77 |
input_text = "A military COR3 "+input_text
|
| 78 |
image = input_image_editor['background']
|
| 79 |
mask = input_image_editor['layers'][0]
|
| 80 |
|
| 81 |
if not image:
|
| 82 |
gr.Info("Please upload an image.")
|
| 83 |
+
return None, None
|
| 84 |
|
| 85 |
width, height = resize_image_dimensions(original_resolution_wh=image.size)
|
| 86 |
resized_image = image.resize((width, height), Image.LANCZOS)
|
|
|
|
| 96 |
image=resized_image,
|
| 97 |
width=width,
|
| 98 |
height=height,
|
| 99 |
+
num_images_per_prompt =2,
|
| 100 |
strength=strength_slider,
|
| 101 |
generator=generator,
|
| 102 |
joint_attention_kwargs={"scale": 1.2},
|
| 103 |
num_inference_steps=num_inference_steps_slider
|
| 104 |
)
|
| 105 |
print('INFERENCE DONE')
|
| 106 |
+
return result.images[0], result.images[1]
|
| 107 |
|
| 108 |
#resized_mask = mask.resize((width, height), Image.LANCZOS)
|
| 109 |
|
|
|
|
| 183 |
type='pil', image_mode='RGB', label='Generated image', format="png")
|
| 184 |
output_image_component2 = gr.Image(
|
| 185 |
type='pil', image_mode='RGB', label='Generated image', format="png")
|
| 186 |
+
|
|
|
|
|
|
|
|
|
|
| 187 |
|
| 188 |
|
| 189 |
submit_button_component.click(
|
|
|
|
| 198 |
],
|
| 199 |
outputs=[
|
| 200 |
output_image_component,
|
| 201 |
+
output_image_component2
|
|
|
|
|
|
|
| 202 |
]
|
| 203 |
)
|
| 204 |
|