Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ pipeline = StableDiffusion3InpaintPipeline.from_pretrained("stabilityai/stable-d
|
|
17 |
def get_select_index(evt: gr.SelectData):
|
18 |
return evt.index
|
19 |
|
20 |
-
@spaces.GPU()
|
21 |
def squarify_image(img):
|
22 |
if(img.height > img.width): bg_size = img.height
|
23 |
else: bg_size = img.width
|
@@ -26,7 +26,7 @@ def squarify_image(img):
|
|
26 |
|
27 |
return bg
|
28 |
|
29 |
-
@spaces.GPU()
|
30 |
def divisible_by_8(image):
|
31 |
width, height = image.size
|
32 |
|
@@ -39,7 +39,7 @@ def divisible_by_8(image):
|
|
39 |
|
40 |
return resized_image
|
41 |
|
42 |
-
@spaces.GPU()
|
43 |
def restore_version(index, versions):
|
44 |
print('restore version:', index)
|
45 |
final_dict = {'background': versions[index][0], 'layers': None, 'composite': versions[index][0]}
|
@@ -122,13 +122,13 @@ with gr.Blocks() as demo:
|
|
122 |
clear_button = gr.Button('Clear', visible=False)
|
123 |
selected = gr.Number(show_label=False, visible=False)
|
124 |
|
125 |
-
gr.Examples(
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
)
|
132 |
|
133 |
version_gallery.select(get_select_index, None, selected)
|
134 |
generate_button.click(fn=generate, inputs=[sketch_pad,prompt, neg_prompt, version_gallery], outputs=[sketch_pad, version_gallery, restore_button, clear_button])
|
|
|
17 |
def get_select_index(evt: gr.SelectData):
|
18 |
return evt.index
|
19 |
|
20 |
+
# @spaces.GPU()
|
21 |
def squarify_image(img):
|
22 |
if(img.height > img.width): bg_size = img.height
|
23 |
else: bg_size = img.width
|
|
|
26 |
|
27 |
return bg
|
28 |
|
29 |
+
# @spaces.GPU()
|
30 |
def divisible_by_8(image):
|
31 |
width, height = image.size
|
32 |
|
|
|
39 |
|
40 |
return resized_image
|
41 |
|
42 |
+
# @spaces.GPU()
|
43 |
def restore_version(index, versions):
|
44 |
print('restore version:', index)
|
45 |
final_dict = {'background': versions[index][0], 'layers': None, 'composite': versions[index][0]}
|
|
|
122 |
clear_button = gr.Button('Clear', visible=False)
|
123 |
selected = gr.Number(show_label=False, visible=False)
|
124 |
|
125 |
+
# gr.Examples(
|
126 |
+
# [[{'background':'./tony.jpg', 'layers':['./tony-mask.jpg'], 'composite':'./tony.jpg'}, 'black and white tuxedo, bowtie', 'ugly', None]],
|
127 |
+
# [sketch_pad, prompt, neg_prompt, version_gallery],
|
128 |
+
# [sketch_pad, version_gallery, restore_button, clear_button],
|
129 |
+
# generate,
|
130 |
+
# cache_examples=True,
|
131 |
+
# )
|
132 |
|
133 |
version_gallery.select(get_select_index, None, selected)
|
134 |
generate_button.click(fn=generate, inputs=[sketch_pad,prompt, neg_prompt, version_gallery], outputs=[sketch_pad, version_gallery, restore_button, clear_button])
|