gokaygokay commited on
Commit
1ebaa97
·
verified ·
1 Parent(s): 1782f95

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
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.95):
26
  if seed is None:
27
  seed = random.randint(0, MAX_SEED)
28
  generator = torch.Generator(device="cuda").manual_seed(seed)
@@ -38,16 +38,16 @@ 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.95):
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
45
  steps = 28
46
  randomize_seed = True
47
  seed = None
48
  width = 1024
49
  height = 1024
50
- lora_scale = 0.95
51
 
52
  if randomize_seed or seed is None:
53
  seed = random.randint(0, MAX_SEED)
@@ -75,10 +75,10 @@ custom_css = """
75
  title = """<h1 align="center">FLUX Creativity LoRA</h1>
76
  """
77
  examples = [
78
- "anime, cartoon, Hyper-detailed, endearing anime girl, bathed in a vibrant, colorful psychedelic glow, wearing dazzling, holographic Liquid Metal outfit, in a cozy tatami studio",
79
- "extraterrestrial visage, close-up, highly intricate, ultra-detailed, full high definition",
80
- "a full body photo shot of a beautiful and breathtaking image of a ((Man) ) wearing a fully clothed casual witchy witch clothes with intricate details in the style of a reapers cloak, he is holding a long curved double edged ((scythe) ). This full body image is a one of a kind unique highly detailed with 8k sharp focus quality masterpiece, hyper detailed, extremely detailed",
81
- "schizophrenia attacks,go haywire, go crazy, hyper detailed, extremely detailed",
82
  ]
83
 
84
  with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="gray"), css=custom_css) as app:
@@ -110,7 +110,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="gray"), c
110
 
111
  gr.Examples(
112
  examples=examples,
113
- inputs=[prompt],
114
  outputs=[result, seed],
115
  fn=run_lora,
116
  cache_examples=True
 
22
  MAX_SEED = 2**32-1
23
 
24
  @spaces.GPU(duration=75)
25
+ def generate_image(prompt, steps=28, seed=None, cfg_scale=2.8, 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
  ).images[0]
39
  return image
40
 
41
+ def run_lora(prompt, cfg_scale=2.8, 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 = 2.8
45
  steps = 28
46
  randomize_seed = True
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)
 
75
  title = """<h1 align="center">FLUX Creativity LoRA</h1>
76
  """
77
  examples = [
78
+ ["anime, cartoon, Hyper-detailed, endearing anime girl, bathed in a vibrant, colorful psychedelic glow, wearing dazzling, holographic Liquid Metal outfit, in a cozy tatami studio", 0.5],
79
+ ["extraterrestrial visage, close-up, highly intricate, ultra-detailed, full high definition", 0.5],
80
+ ["a full body photo shot of a beautiful and breathtaking image of a ((Man) ) wearing a fully clothed casual witchy witch clothes with intricate details in the style of a reapers cloak, he is holding a long curved double edged ((scythe) ). This full body image is a one of a kind unique highly detailed with 8k sharp focus quality masterpiece, hyper detailed, extremely detailed", 0.5],
81
+ ["schizophrenia attacks,go haywire, go crazy, hyper detailed, extremely detailed", 0.5],
82
  ]
83
 
84
  with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="gray"), css=custom_css) as app:
 
110
 
111
  gr.Examples(
112
  examples=examples,
113
+ inputs=[prompt, lora_scale],
114
  outputs=[result, seed],
115
  fn=run_lora,
116
  cache_examples=True