Update app.py
Browse files
app.py
CHANGED
@@ -39,14 +39,14 @@ MAX_IMAGE_SIZE = 1216
|
|
39 |
|
40 |
|
41 |
@spaces.GPU
|
42 |
-
def infer(image, prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps) -> PIL.Image.Image:
|
43 |
# Check if the input image is a valid PIL Image and is not empty
|
44 |
if isinstance(image, PIL.Image.Image) and image.size != (0, 0):
|
45 |
use_image = True
|
46 |
-
width, height = image.size
|
47 |
ratio = np.sqrt(1024. * 1024. / (width * height))
|
48 |
new_width, new_height = int(width * ratio), int(height * ratio)
|
49 |
-
image = image.resize((new_width, new_height))
|
50 |
print(image)
|
51 |
else:
|
52 |
use_image = False
|
|
|
39 |
|
40 |
|
41 |
@spaces.GPU
|
42 |
+
def infer(image: PIL.Image.Image, prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps) -> PIL.Image.Image:
|
43 |
# Check if the input image is a valid PIL Image and is not empty
|
44 |
if isinstance(image, PIL.Image.Image) and image.size != (0, 0):
|
45 |
use_image = True
|
46 |
+
width, height = image['composite'].size
|
47 |
ratio = np.sqrt(1024. * 1024. / (width * height))
|
48 |
new_width, new_height = int(width * ratio), int(height * ratio)
|
49 |
+
image = image['composite'].resize((new_width, new_height))
|
50 |
print(image)
|
51 |
else:
|
52 |
use_image = False
|