Yuanshi commited on
Commit
e5bea58
·
verified ·
1 Parent(s): 6631fab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -6,12 +6,22 @@ import random
6
  from PIL import Image
7
 
8
  from diffusers import FluxKontextPipeline
 
 
9
  from diffusers.utils import load_image
10
 
11
  MAX_SEED = np.iinfo(np.int32).max
12
 
13
  pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", torch_dtype=torch.bfloat16).to("cuda")
14
 
 
 
 
 
 
 
 
 
15
  @spaces.GPU
16
  def infer(input_image, prompt, seed=42, randomize_seed=False, guidance_scale=2.5, steps=28, progress=gr.Progress(track_tqdm=True)):
17
  """
@@ -130,7 +140,7 @@ Image editing and manipulation model guidance-distilled from FLUX.1 Kontext [pro
130
  label="Steps",
131
  minimum=1,
132
  maximum=30,
133
- value=28,
134
  step=1
135
  )
136
 
 
6
  from PIL import Image
7
 
8
  from diffusers import FluxKontextPipeline
9
+ from diffusers.models import FluxTransformer2DModel
10
+
11
  from diffusers.utils import load_image
12
 
13
  MAX_SEED = np.iinfo(np.int32).max
14
 
15
  pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", torch_dtype=torch.bfloat16).to("cuda")
16
 
17
+ # New Here
18
+ turbo = FluxTransformer2DModel.from_pretrained(
19
+ "Yuanshi/FLUX.1-Kontext-Turbo", subfolder="transformer", torch_dtype=torch.bfloat16
20
+ ).to("cuda")
21
+ pipe.transformer = turbo
22
+
23
+ print("Model dev loaded.")
24
+
25
  @spaces.GPU
26
  def infer(input_image, prompt, seed=42, randomize_seed=False, guidance_scale=2.5, steps=28, progress=gr.Progress(track_tqdm=True)):
27
  """
 
140
  label="Steps",
141
  minimum=1,
142
  maximum=30,
143
+ value=8,
144
  step=1
145
  )
146