kaytoo2022 commited on
Commit
6811fb5
·
verified ·
1 Parent(s): f44f441

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -23,19 +23,21 @@ pipe.load_lora_weights(lora_ghibli, adapter_name='ghibli')
23
  lora_repo_anime = "aleksa-codes/flux-ghibsky-illustration"
24
  pipe.load_lora_weights(lora_repo_anime, adapter_name='ghibsky')
25
 
26
- pipe.set_adapters(["kaytoo", "ghibli", "ghibsky"], adapter_weights=[0.85, 0.65, 0.65])
27
 
28
  pipe.to("cuda")
29
 
30
  MAX_SEED = 2**32-1
31
 
32
  @spaces.GPU()
33
- def run_lora(prompt, cfg_scale, steps, randomize_seed, seed, width, height, lora_scale, progress=gr.Progress(track_tqdm=True)):
34
  # Set random seed for reproducibility
35
  if randomize_seed:
36
  seed = random.randint(0, MAX_SEED)
37
  generator = torch.Generator(device="cuda").manual_seed(seed)
38
 
 
 
39
  # Update progress bar (0% saat mulai)
40
  progress(0, "Starting image generation...")
41
 
@@ -53,7 +55,7 @@ def run_lora(prompt, cfg_scale, steps, randomize_seed, seed, width, height, lora
53
  width=width,
54
  height=height,
55
  generator=generator,
56
- joint_attention_kwargs={"scale": lora_scale},
57
  ).images[0]
58
 
59
  # Final update (100%)
@@ -102,7 +104,7 @@ with gr.Blocks() as app:
102
 
103
  generate_button.click(
104
  run_lora,
105
- inputs=[prompt, cfg_scale, steps, randomize_seed, seed, width, height, lora_scale],
106
  outputs=[result, seed]
107
  )
108
 
 
23
  lora_repo_anime = "aleksa-codes/flux-ghibsky-illustration"
24
  pipe.load_lora_weights(lora_repo_anime, adapter_name='ghibsky')
25
 
26
+ pipe.set_adapters(["kaytoo", "ghibli", "ghibsky"], adapter_weights=[0.6, 0.35, 0.55])
27
 
28
  pipe.to("cuda")
29
 
30
  MAX_SEED = 2**32-1
31
 
32
  @spaces.GPU()
33
+ def run_lora(prompt, cfg_scale, steps, randomize_seed, seed, width, height, lora_scale, lora_scale_ghibli, lora_scale_ghibsky, progress=gr.Progress(track_tqdm=True)):
34
  # Set random seed for reproducibility
35
  if randomize_seed:
36
  seed = random.randint(0, MAX_SEED)
37
  generator = torch.Generator(device="cuda").manual_seed(seed)
38
 
39
+ pipe.set_adapters(["kaytoo", "ghibli", "ghibsky"], adapter_weights=[lora_scale, lora_scale_2])
40
+
41
  # Update progress bar (0% saat mulai)
42
  progress(0, "Starting image generation...")
43
 
 
55
  width=width,
56
  height=height,
57
  generator=generator,
58
+ # joint_attention_kwargs={"scale": lora_scale},
59
  ).images[0]
60
 
61
  # Final update (100%)
 
104
 
105
  generate_button.click(
106
  run_lora,
107
+ inputs=[prompt, cfg_scale, steps, randomize_seed, seed, width, height, lora_scale, lora_scale_ghibli, lora_scale_ghibsky],
108
  outputs=[result, seed]
109
  )
110