prithivMLmods commited on
Commit
7c62c84
·
verified ·
1 Parent(s): af8283d

update app

Browse files
Files changed (1) hide show
  1. app.py +6 -12
app.py CHANGED
@@ -10,8 +10,9 @@ import random
10
  import base64
11
  from io import BytesIO
12
  from PIL import Image
 
13
 
14
- from diffusers import Flux2KleinPipeline, AutoencoderKLFlux2
15
 
16
  MAX_SEED = np.iinfo(np.int32).max
17
  LANCZOS = getattr(Image, "Resampling", Image).LANCZOS
@@ -21,19 +22,12 @@ dtype = torch.bfloat16
21
 
22
  print("Using device:", device)
23
 
24
- print("Loading Small Decoder VAE...")
25
- vae_small = AutoencoderKLFlux2.from_pretrained(
26
- "black-forest-labs/FLUX.2-small-decoder",
27
- torch_dtype=dtype,
28
- ).to(device)
29
-
30
- print("Loading 4B Distilled model (Small Decoder VAE)...")
31
  pipe = Flux2KleinPipeline.from_pretrained(
32
- "black-forest-labs/FLUX.2-klein-4B",
33
- vae=vae_small,
34
  torch_dtype=dtype,
35
  ).to(device)
36
- print("Pipeline loaded directly to CUDA.")
37
 
38
  def pil_to_b64_png(image: Image.Image) -> str:
39
  buf = BytesIO()
@@ -56,7 +50,7 @@ def infer(
56
  steps: int,
57
  guidance_scale: float,
58
  ) -> dict:
59
- """Generates an image from a scribble using FLUX.2 Klein 4B."""
60
  gc.collect()
61
  torch.cuda.empty_cache()
62
 
 
10
  import base64
11
  from io import BytesIO
12
  from PIL import Image
13
+ from typing import Tuple
14
 
15
+ from diffusers import Flux2KleinPipeline
16
 
17
  MAX_SEED = np.iinfo(np.int32).max
18
  LANCZOS = getattr(Image, "Resampling", Image).LANCZOS
 
22
 
23
  print("Using device:", device)
24
 
25
+ print("Loading FLUX.2 Klein 9B model base...")
 
 
 
 
 
 
26
  pipe = Flux2KleinPipeline.from_pretrained(
27
+ "black-forest-labs/FLUX.2-klein-9B",
 
28
  torch_dtype=dtype,
29
  ).to(device)
30
+ print("Base Model loaded successfully.")
31
 
32
  def pil_to_b64_png(image: Image.Image) -> str:
33
  buf = BytesIO()
 
50
  steps: int,
51
  guidance_scale: float,
52
  ) -> dict:
53
+ """Generates an image from a scribble using FLUX.2 Klein 9B."""
54
  gc.collect()
55
  torch.cuda.empty_cache()
56