Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,7 @@ from controlnet_flux import FluxControlNetModel
|
|
| 5 |
from transformer_flux import FluxTransformer2DModel
|
| 6 |
from pipeline_flux_controlnet_inpaint import FluxControlNetInpaintingPipeline
|
| 7 |
from PIL import Image, ImageDraw
|
|
|
|
| 8 |
|
| 9 |
# Load models
|
| 10 |
controlnet = FluxControlNetModel.from_pretrained("alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha", torch_dtype=torch.bfloat16)
|
|
@@ -47,6 +48,7 @@ def prepare_image_and_mask(image, width, height, overlap_percentage):
|
|
| 47 |
|
| 48 |
return background, mask
|
| 49 |
|
|
|
|
| 50 |
def inpaint(image, prompt, width, height, overlap_percentage, num_inference_steps, guidance_scale):
|
| 51 |
# Prepare image and mask
|
| 52 |
image, mask = prepare_image_and_mask(image, width, height, overlap_percentage)
|
|
|
|
| 5 |
from transformer_flux import FluxTransformer2DModel
|
| 6 |
from pipeline_flux_controlnet_inpaint import FluxControlNetInpaintingPipeline
|
| 7 |
from PIL import Image, ImageDraw
|
| 8 |
+
import spaces
|
| 9 |
|
| 10 |
# Load models
|
| 11 |
controlnet = FluxControlNetModel.from_pretrained("alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha", torch_dtype=torch.bfloat16)
|
|
|
|
| 48 |
|
| 49 |
return background, mask
|
| 50 |
|
| 51 |
+
@spaces.GPU
|
| 52 |
def inpaint(image, prompt, width, height, overlap_percentage, num_inference_steps, guidance_scale):
|
| 53 |
# Prepare image and mask
|
| 54 |
image, mask = prepare_image_and_mask(image, width, height, overlap_percentage)
|