Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,7 +12,7 @@ def get_select_index(evt: gr.SelectData):
|
|
| 12 |
print(evt)
|
| 13 |
return evt.index
|
| 14 |
|
| 15 |
-
|
| 16 |
def squarify_image(img):
|
| 17 |
if(img.height > img.width): bg_size = img.height
|
| 18 |
else: bg_size = img.width
|
|
@@ -21,7 +21,7 @@ def squarify_image(img):
|
|
| 21 |
|
| 22 |
return bg
|
| 23 |
|
| 24 |
-
|
| 25 |
def divisible_by_8(image):
|
| 26 |
width, height = image.size
|
| 27 |
|
|
@@ -34,13 +34,13 @@ def divisible_by_8(image):
|
|
| 34 |
|
| 35 |
return resized_image
|
| 36 |
|
| 37 |
-
|
| 38 |
def restore_version(index, versions):
|
| 39 |
print('restore version:', index)
|
| 40 |
final_dict = {'background': versions[index][0], 'layers': None, 'composite': versions[index][0]}
|
| 41 |
return final_dict
|
| 42 |
|
| 43 |
-
|
| 44 |
def generate(image_editor, prompt, neg_prompt, versions):
|
| 45 |
image = image_editor['background'].convert('RGB')
|
| 46 |
|
|
|
|
| 12 |
print(evt)
|
| 13 |
return evt.index
|
| 14 |
|
| 15 |
+
#@spaces.GPU()
|
| 16 |
def squarify_image(img):
|
| 17 |
if(img.height > img.width): bg_size = img.height
|
| 18 |
else: bg_size = img.width
|
|
|
|
| 21 |
|
| 22 |
return bg
|
| 23 |
|
| 24 |
+
#@spaces.GPU()
|
| 25 |
def divisible_by_8(image):
|
| 26 |
width, height = image.size
|
| 27 |
|
|
|
|
| 34 |
|
| 35 |
return resized_image
|
| 36 |
|
| 37 |
+
#@spaces.GPU()
|
| 38 |
def restore_version(index, versions):
|
| 39 |
print('restore version:', index)
|
| 40 |
final_dict = {'background': versions[index][0], 'layers': None, 'composite': versions[index][0]}
|
| 41 |
return final_dict
|
| 42 |
|
| 43 |
+
#@spaces.GPU()
|
| 44 |
def generate(image_editor, prompt, neg_prompt, versions):
|
| 45 |
image = image_editor['background'].convert('RGB')
|
| 46 |
|