(function, img, guidance_scale=2., merged_image=False, remove_bg=True)
| 26 | |
| 27 | from app.utils import make_image_grid, split_image |
| 28 | def process_image(function, img, guidance_scale=2., merged_image=False, remove_bg=True): |
| 29 | from rembg import remove |
| 30 | if remove_bg: |
| 31 | img = remove(img) |
| 32 | img = rgba_to_rgb(img) |
| 33 | if merged_image: |
| 34 | img = split_image(img, rows=2) |
| 35 | images = function( |
| 36 | image=img, |
| 37 | guidance_scale=guidance_scale, |
| 38 | ) |
| 39 | if len(images) > 1: |
| 40 | return make_image_grid(images, rows=2) |
| 41 | else: |
| 42 | return images[0] |
| 43 | |
| 44 | |
| 45 | def process_text(trainer, pipeline, img, guidance_scale=2.): |
nothing calls this directly
no test coverage detected