Spaces:
Runtime error
Runtime error
inflate mask before blur
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import gradio as gr
|
|
5 |
import numpy as np
|
6 |
import spaces
|
7 |
import torch
|
8 |
-
from PIL import Image, ImageFilter
|
9 |
from diffusers import FluxInpaintPipeline
|
10 |
from gradio_client import Client, handle_file
|
11 |
|
@@ -138,6 +138,7 @@ def process(
|
|
138 |
api_name="/process_image")
|
139 |
mask = Image.open(mask)
|
140 |
|
|
|
141 |
mask = mask.filter(ImageFilter.GaussianBlur(radius=5))
|
142 |
width, height = resize_image_dimensions(original_resolution_wh=image.size)
|
143 |
image = image.resize((width, height), Image.LANCZOS)
|
|
|
5 |
import numpy as np
|
6 |
import spaces
|
7 |
import torch
|
8 |
+
from PIL import Image, ImageFilter, ImageOps
|
9 |
from diffusers import FluxInpaintPipeline
|
10 |
from gradio_client import Client, handle_file
|
11 |
|
|
|
138 |
api_name="/process_image")
|
139 |
mask = Image.open(mask)
|
140 |
|
141 |
+
mask = ImageOps.expand(mask, border=5, fill=255)
|
142 |
mask = mask.filter(ImageFilter.GaussianBlur(radius=5))
|
143 |
width, height = resize_image_dimensions(original_resolution_wh=image.size)
|
144 |
image = image.resize((width, height), Image.LANCZOS)
|