| 1231 | return caption |
| 1232 | |
| 1233 | def resize_image(self, image, max_size=1000000, multiple=8): |
| 1234 | aspect_ratio = image.size[0] / image.size[1] |
| 1235 | new_width = int(math.sqrt(max_size * aspect_ratio)) |
| 1236 | new_height = int(new_width / aspect_ratio) |
| 1237 | new_width, new_height = new_width - (new_width % multiple), new_height - (new_height % multiple) |
| 1238 | return image.resize((new_width, new_height)) |
| 1239 | |
| 1240 | def dowhile(self, original_img, tosize, expand_ratio, imagine, usr_prompt): |
| 1241 | old_img = original_img |