Spaces:
Running
Running
HatmanStack
commited on
Commit
·
87f74e2
1
Parent(s):
552a8f8
removed link
Browse files
app.py
CHANGED
@@ -18,12 +18,6 @@ def update_mask_editor(img):
|
|
18 |
return None
|
19 |
return create_padded_image(img)
|
20 |
|
21 |
-
def update_canvas_size(image):
|
22 |
-
img = image['background']
|
23 |
-
width, height = img.size
|
24 |
-
width_container = max(width, 800)
|
25 |
-
height_container = max(height, 800)
|
26 |
-
return gr.update(canvas_size=(width, height), height=height_container + 20, width=width_container)
|
27 |
|
28 |
def create_advanced_options():
|
29 |
|
@@ -55,8 +49,7 @@ with gr.Blocks() as demo:
|
|
55 |
</style>
|
56 |
""")
|
57 |
gr.Markdown("""
|
58 |
-
<h1>AWS Nova Canvas Image Generation</h1
|
59 |
-
with Gradio ImageEditor in Chrome</p>Try Edge if having trouble with High Resource Usage</p>""", elem_classes="center-markdown" )
|
60 |
|
61 |
with gr.Tab("Text to Image"):
|
62 |
with gr.Column():
|
@@ -95,7 +88,6 @@ with gr.Blocks() as demo:
|
|
95 |
canvas_size = [450,450],
|
96 |
label="Draw mask (black areas will be edited)",
|
97 |
)
|
98 |
-
mask_image.change(fn=update_canvas_size, inputs=mask_image, outputs=mask_image)
|
99 |
|
100 |
with gr.Accordion("Optional Mask Prompt", open=False):
|
101 |
mask_prompt = gr.Textbox(label="Mask Prompt", placeholder="Describe regions to edit", max_lines=1)
|
@@ -129,7 +121,6 @@ with gr.Blocks() as demo:
|
|
129 |
canvas_size = [450,450],
|
130 |
label="Crop the Image (transparent areas will be edited)"
|
131 |
)
|
132 |
-
mask_image.change(fn=update_canvas_size, inputs=mask_image, outputs=mask_image)
|
133 |
gr.Button("Create Padding").click(fn=update_mask_editor, inputs=[mask_image], outputs=[mask_image])
|
134 |
|
135 |
with gr.Accordion("Optional Mask Prompt", open=False):
|
|
|
18 |
return None
|
19 |
return create_padded_image(img)
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
def create_advanced_options():
|
23 |
|
|
|
49 |
</style>
|
50 |
""")
|
51 |
gr.Markdown("""
|
52 |
+
<h1>AWS Nova Canvas Image Generation</h1>""", elem_classes="center-markdown" )
|
|
|
53 |
|
54 |
with gr.Tab("Text to Image"):
|
55 |
with gr.Column():
|
|
|
88 |
canvas_size = [450,450],
|
89 |
label="Draw mask (black areas will be edited)",
|
90 |
)
|
|
|
91 |
|
92 |
with gr.Accordion("Optional Mask Prompt", open=False):
|
93 |
mask_prompt = gr.Textbox(label="Mask Prompt", placeholder="Describe regions to edit", max_lines=1)
|
|
|
121 |
canvas_size = [450,450],
|
122 |
label="Crop the Image (transparent areas will be edited)"
|
123 |
)
|
|
|
124 |
gr.Button("Create Padding").click(fn=update_mask_editor, inputs=[mask_image], outputs=[mask_image])
|
125 |
|
126 |
with gr.Accordion("Optional Mask Prompt", open=False):
|