gokaygokay commited on
Commit
06a2522
·
verified ·
1 Parent(s): 4348c83

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -22,7 +22,7 @@ pipe.fuse_lora()
22
  MAX_SEED = 2**32-1
23
 
24
  @spaces.GPU(duration=75)
25
- def generate_image(prompt, steps=28, seed=None, cfg_scale=3.5, width=1024, height=1024, lora_scale=0.5):
26
  if seed is None:
27
  seed = random.randint(0, MAX_SEED)
28
  generator = torch.Generator(device="cuda").manual_seed(seed)
@@ -38,7 +38,7 @@ def generate_image(prompt, steps=28, seed=None, cfg_scale=3.5, width=1024, heigh
38
  ).images[0]
39
  return image
40
 
41
- def run_lora(prompt, cfg_scale=3.5, steps=28, randomize_seed=True, seed=None, width=1024, height=1024, lora_scale=0.5):
42
  # Handle the case when only prompt is provided (for Examples)
43
  if isinstance(prompt, str) and all(param is None for param in [cfg_scale, steps, randomize_seed, seed, width, height, lora_scale]):
44
  cfg_scale = 3.5
@@ -47,7 +47,7 @@ def run_lora(prompt, cfg_scale=3.5, steps=28, randomize_seed=True, seed=None, wi
47
  seed = None
48
  width = 1024
49
  height = 1024
50
- lora_scale = 0.5
51
 
52
  if randomize_seed or seed is None:
53
  seed = random.randint(0, MAX_SEED)
@@ -95,7 +95,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="gray"), c
95
  height = gr.Slider(label="Height", minimum=256, maximum=1536, step=64, value=1024)
96
  randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
97
  seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0)
98
- lora_scale = gr.Slider(label="LoRA Scale", minimum=0, maximum=1, step=0.01, value=0.95)
99
 
100
  generate_button = gr.Button("Generate", variant="primary", elem_classes="submit-btn")
101
 
 
22
  MAX_SEED = 2**32-1
23
 
24
  @spaces.GPU(duration=75)
25
+ def generate_image(prompt, steps=28, seed=None, cfg_scale=3.5, width=1024, height=1024, lora_scale=1.0):
26
  if seed is None:
27
  seed = random.randint(0, MAX_SEED)
28
  generator = torch.Generator(device="cuda").manual_seed(seed)
 
38
  ).images[0]
39
  return image
40
 
41
+ def run_lora(prompt, cfg_scale=3.5, steps=28, randomize_seed=True, seed=None, width=1024, height=1024, lora_scale=1.0):
42
  # Handle the case when only prompt is provided (for Examples)
43
  if isinstance(prompt, str) and all(param is None for param in [cfg_scale, steps, randomize_seed, seed, width, height, lora_scale]):
44
  cfg_scale = 3.5
 
47
  seed = None
48
  width = 1024
49
  height = 1024
50
+ lora_scale = 1.0
51
 
52
  if randomize_seed or seed is None:
53
  seed = random.randint(0, MAX_SEED)
 
95
  height = gr.Slider(label="Height", minimum=256, maximum=1536, step=64, value=1024)
96
  randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
97
  seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0)
98
+ lora_scale = gr.Slider(label="LoRA Scale", minimum=0.0, maximum=1.0, step=0.01, value=1.0)
99
 
100
  generate_button = gr.Button("Generate", variant="primary", elem_classes="submit-btn")
101