arj7192 commited on
Commit
cb2d4ba
·
verified ·
1 Parent(s): a03a51d

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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
- mps_device =torch.device("mps")
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(mps_device)
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="mps").manual_seed(seed)
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],