Spaces:
Running
on
Zero
Running
on
Zero
Upload app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ transformer = FluxTransformer2DModel.from_pretrained(
|
|
14 |
"black-forest-labs/FLUX.1-dev", subfolder='transformer', torch_dytpe=torch.bfloat16
|
15 |
)
|
16 |
|
17 |
-
|
18 |
# Build pipeline
|
19 |
controlnet = FluxControlNetModel.from_pretrained("alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Beta", torch_dtype=torch.bfloat16)
|
20 |
pipe = FluxControlNetInpaintingPipeline.from_pretrained(
|
@@ -22,7 +22,7 @@ pipe = FluxControlNetInpaintingPipeline.from_pretrained(
|
|
22 |
controlnet=controlnet,
|
23 |
transformer=transformer,
|
24 |
torch_dtype=torch.bfloat16
|
25 |
-
).to(
|
26 |
pipe.transformer.to(torch.bfloat16)
|
27 |
pipe.controlnet.to(torch.bfloat16)
|
28 |
|
@@ -49,7 +49,7 @@ def process(input_image_editor,
|
|
49 |
|
50 |
image = image.convert("RGB").resize(size)
|
51 |
mask = mask.convert("RGB").resize(size)
|
52 |
-
generator = torch.Generator(device="
|
53 |
result = pipe(
|
54 |
prompt=prompt,
|
55 |
height=size[1],
|
|
|
14 |
"black-forest-labs/FLUX.1-dev", subfolder='transformer', torch_dytpe=torch.bfloat16
|
15 |
)
|
16 |
|
17 |
+
cuda_device =torch.device("cuda")
|
18 |
# Build pipeline
|
19 |
controlnet = FluxControlNetModel.from_pretrained("alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Beta", torch_dtype=torch.bfloat16)
|
20 |
pipe = FluxControlNetInpaintingPipeline.from_pretrained(
|
|
|
22 |
controlnet=controlnet,
|
23 |
transformer=transformer,
|
24 |
torch_dtype=torch.bfloat16
|
25 |
+
).to(cuda_device)
|
26 |
pipe.transformer.to(torch.bfloat16)
|
27 |
pipe.controlnet.to(torch.bfloat16)
|
28 |
|
|
|
49 |
|
50 |
image = image.convert("RGB").resize(size)
|
51 |
mask = mask.convert("RGB").resize(size)
|
52 |
+
generator = torch.Generator(device="cuda").manual_seed(seed)
|
53 |
result = pipe(
|
54 |
prompt=prompt,
|
55 |
height=size[1],
|