vilarin commited on
Commit
36093ae
·
verified ·
1 Parent(s): f2702be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -6,10 +6,21 @@ import random
6
  import numpy as np
7
 
8
  MAX_SEED = np.iinfo(np.int32).max
9
- DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
10
 
11
- pipe = FluxInpaintPipeline.from_pretrained(
12
- "black-forest-labs/FLUX.1-Fill-dev", torch_dtype=torch.bfloat16).to(DEVICE)
 
 
 
 
 
 
 
 
 
 
 
13
 
14
 
15
  @spaces.GPU()
 
6
  import numpy as np
7
 
8
  MAX_SEED = np.iinfo(np.int32).max
9
+ model = "black-forest-labs/FLUX.1-dev"
10
 
11
+ if torch.cuda.is_available():
12
+ transformer = FluxTransformer2DModel.from_single_file(
13
+ "https://huggingface.co/black-forest-labs/FLUX.1-Fill-dev/blob/main/flux1-fill-dev.safetensors",
14
+ torch_dtype=torch.bfloat16
15
+ )
16
+ pipe = FluxPipeline.from_pretrained(
17
+ model,
18
+ transformer=transformer,
19
+ torch_dtype=torch.bfloat16)
20
+ pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_config(
21
+ pipe.scheduler.config, use_beta_sigmas=True
22
+ )
23
+ pipe.to("cuda")
24
 
25
 
26
  @spaces.GPU()