Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- frontend/app.py +1 -1
- frontend/utils.py +2 -2
frontend/app.py
CHANGED
@@ -13,7 +13,7 @@ def run_inpainting(img_1, img_2, img_3, img_4, alpha_gradient_width, init_image_
|
|
13 |
if USE_FASTAPI:
|
14 |
return call_inpainting_api(img_1, img_2, img_3, img_4, alpha_gradient_width, init_image_height)
|
15 |
else:
|
16 |
-
return process_images_and_inpaint(images, alpha_gradient_width, init_image_height)
|
17 |
|
18 |
def call_inpainting_api(img_1, img_2, img_3, img_4, alpha_gradient_width, init_image_height):
|
19 |
images = []
|
|
|
13 |
if USE_FASTAPI:
|
14 |
return call_inpainting_api(img_1, img_2, img_3, img_4, alpha_gradient_width, init_image_height)
|
15 |
else:
|
16 |
+
return process_images_and_inpaint(images, int(alpha_gradient_width), int(init_image_height))
|
17 |
|
18 |
def call_inpainting_api(img_1, img_2, img_3, img_4, alpha_gradient_width, init_image_height):
|
19 |
images = []
|
frontend/utils.py
CHANGED
@@ -34,7 +34,7 @@ def resize_image(image, max_height=768):
|
|
34 |
scale = max_height/image.height
|
35 |
return image.resize((int(image.width * scale), int(image.height * scale)))
|
36 |
|
37 |
-
def prepare_init_image_mask(images: [Image.Image], alpha_gradient_width=
|
38 |
total_width = sum([ im.width for im in images])
|
39 |
init_image = Image.new('RGBA', (total_width,init_image_height))
|
40 |
|
@@ -108,7 +108,7 @@ def inpainting_api_call(input_image, input_mask, token, endpoint):
|
|
108 |
|
109 |
json_data = dumps(body)
|
110 |
start = time.time()
|
111 |
-
resp_inpaint = requests.post(endpoint, data=json_data, headers={"Authorization": f"Bearer {token}"})
|
112 |
print(f"Execution time: {time.time() - start}")
|
113 |
return b64_to_pil(resp_inpaint.json()['output']['inpainted_image_b64'])
|
114 |
|
|
|
34 |
scale = max_height/image.height
|
35 |
return image.resize((int(image.width * scale), int(image.height * scale)))
|
36 |
|
37 |
+
def prepare_init_image_mask(images: [Image.Image], alpha_gradient_width=100, init_image_height=768): # type: ignore
|
38 |
total_width = sum([ im.width for im in images])
|
39 |
init_image = Image.new('RGBA', (total_width,init_image_height))
|
40 |
|
|
|
108 |
|
109 |
json_data = dumps(body)
|
110 |
start = time.time()
|
111 |
+
resp_inpaint = requests.post(endpoint, data=json_data, headers={"Authorization": f"Bearer {token}"}, verify=False)
|
112 |
print(f"Execution time: {time.time() - start}")
|
113 |
return b64_to_pil(resp_inpaint.json()['output']['inpainted_image_b64'])
|
114 |
|