KingNish commited on
Commit
3bad26c
1 Parent(s): db97287

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -33,7 +33,7 @@ def generate_image(prompt, seed=42, width=DEFAULT_WIDTH, height=DEFAULT_HEIGHT,
33
  # Only generate the last image in the sequence
34
  for img in pipe.generate_images(
35
  prompt=prompt,
36
- guidance_scale=0,
37
  num_inference_steps=num_inference_steps,
38
  width=width,
39
  height=height,
@@ -63,7 +63,7 @@ with gr.Blocks() as demo:
63
  with gr.Column(scale=3):
64
  result = gr.Image(label="Generated Image", show_label=False, interactive=False)
65
  with gr.Column(scale=1):
66
- prompt = gr.Text(
67
  label="Prompt",
68
  placeholder="Describe the image you want to generate...",
69
  lines=3,
@@ -96,8 +96,12 @@ with gr.Blocks() as demo:
96
  cache_examples="lazy"
97
  )
98
 
 
 
 
 
99
  enhanceBtn.click(
100
- fn=generate_image,
101
  inputs=[prompt, seed, width, height],
102
  outputs=[result, seed, latency],
103
  show_progress="hidden",
@@ -135,10 +139,10 @@ with gr.Blocks() as demo:
135
  return next(generate_image(*args[1:]))
136
 
137
  prompt.submit(
138
- fn=realtime_generation,
139
- inputs=[realtime, prompt, seed, width, height, randomize_seed, num_inference_steps],
140
  outputs=[result, seed, latency],
141
- show_progress="hidden",
142
  api_name=False,
143
  queue=False,
144
  concurrency_limit=None
 
33
  # Only generate the last image in the sequence
34
  for img in pipe.generate_images(
35
  prompt=prompt,
36
+ guidance_scale=0, # as Flux schnell is guidance free
37
  num_inference_steps=num_inference_steps,
38
  width=width,
39
  height=height,
 
63
  with gr.Column(scale=3):
64
  result = gr.Image(label="Generated Image", show_label=False, interactive=False)
65
  with gr.Column(scale=1):
66
+ prompt = gr.Textbox(
67
  label="Prompt",
68
  placeholder="Describe the image you want to generate...",
69
  lines=3,
 
96
  cache_examples="lazy"
97
  )
98
 
99
+ def enhance_image(*args):
100
+ gr.Info("Enhancing Image") # currently just runs optimized pipeline for 2 steps. Further implementations later.
101
+ return next(generate_image(*args))
102
+
103
  enhanceBtn.click(
104
+ fn=enhance_image,
105
  inputs=[prompt, seed, width, height],
106
  outputs=[result, seed, latency],
107
  show_progress="hidden",
 
139
  return next(generate_image(*args[1:]))
140
 
141
  prompt.submit(
142
+ fn=generate_image,
143
+ inputs=[prompt, seed, width, height, randomize_seed, num_inference_steps],
144
  outputs=[result, seed, latency],
145
+ show_progress="full",
146
  api_name=False,
147
  queue=False,
148
  concurrency_limit=None