openfree commited on
Commit
ef3fbda
1 Parent(s): fa8752a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -34,15 +34,15 @@ prompt_values = df.values.flatten()
34
  with open('loras.json', 'r') as f:
35
  loras = json.load(f)
36
 
37
-
 
 
38
 
39
  # 공통 FLUX 모델 로드
40
  base_model = "black-forest-labs/FLUX.1-dev"
41
- pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=dtype, device_map="balanced")
42
-
43
- device = "cuda" if torch.cuda.is_available() else "cpu"
44
  pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=dtype, device_map="balanced").to(device)
45
 
 
46
  # LoRA를 위한 설정
47
  taef1 = AutoencoderTiny.from_pretrained("madebyollin/taef1", torch_dtype=dtype).to(device)
48
  good_vae = AutoencoderKL.from_pretrained(base_model, subfolder="vae", torch_dtype=dtype).to(device)
@@ -60,6 +60,11 @@ pipe_i2i = AutoPipelineForImage2Image.from_pretrained(
60
  device_map="balanced"
61
  ).to(device)
62
 
 
 
 
 
 
63
  # Upscale 파이프라인 설정 (기존 pipe 재사용)
64
  pipe_upscale = FluxControlNetPipeline(
65
  vae=pipe.vae,
 
34
  with open('loras.json', 'r') as f:
35
  loras = json.load(f)
36
 
37
+ # Initialize the base model
38
+ dtype = torch.bfloat16
39
+ device = "cuda" if torch.cuda.is_available() else "cpu"
40
 
41
  # 공통 FLUX 모델 로드
42
  base_model = "black-forest-labs/FLUX.1-dev"
 
 
 
43
  pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=dtype, device_map="balanced").to(device)
44
 
45
+
46
  # LoRA를 위한 설정
47
  taef1 = AutoencoderTiny.from_pretrained("madebyollin/taef1", torch_dtype=dtype).to(device)
48
  good_vae = AutoencoderKL.from_pretrained(base_model, subfolder="vae", torch_dtype=dtype).to(device)
 
60
  device_map="balanced"
61
  ).to(device)
62
 
63
+ controlnet = FluxControlNetModel.from_pretrained(
64
+ "jasperai/Flux.1-dev-Controlnet-Upscaler", torch_dtype=torch.bfloat16
65
+ ).to(device)
66
+
67
+
68
  # Upscale 파이프라인 설정 (기존 pipe 재사용)
69
  pipe_upscale = FluxControlNetPipeline(
70
  vae=pipe.vae,