multimodalart HF staff commited on
Commit
e514550
β€’
1 Parent(s): f8e56c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -16
app.py CHANGED
@@ -126,8 +126,8 @@ css='''
126
  #strip, #gif{min-height: 50px}
127
  '''
128
  examples = [["winter", "summer", 1.25, "a dog in the park"], ["USA suburb", "Europe", 2, "a house"], ["rotten", "super fresh", 2, "a tomato"]]
129
- image_seq = gr.Image(label="Strip", elem_id="strip")
130
- output_image = gr.Image(label="Gif", elem_id="gif")
131
  post_generation_image = gr.Image(label="Generated Images")
132
  post_generation_slider = gr.Slider(minimum=-10, maximum=10, value=0, step=1)
133
  seed = gr.Slider(minimum=0, maximum=MAX_SEED, step=1, label="Seed", interactive=True, randomize=True)
@@ -152,13 +152,7 @@ with gr.Blocks(css=css) as demo:
152
  prompt = gr.Textbox(label="Prompt", info="Describe what you to be steered by the directions", placeholder="A dog in the park")
153
  x = gr.Slider(minimum=0, value=1.5, step=0.1, maximum=4.0, label="Strength", info="maximum strength on each direction (unstable beyond 2.5)")
154
  submit = gr.Button("Generate directions")
155
- gr.Examples(
156
- examples=examples,
157
- inputs=[concept_1, concept_2, x, prompt],
158
- fn=generate,
159
- outputs=[x_concept_1, x_concept_2, avg_diff_x, output_image, image_seq, total_images, post_generation_image, post_generation_slider, seed],
160
- cache_examples="lazy"
161
- )
162
  with gr.Column():
163
  with gr.Group(elem_id="group"):
164
  post_generation_image.render()
@@ -175,15 +169,24 @@ with gr.Blocks(css=css) as demo:
175
  steps = gr.Slider(label = "num inference steps", minimum=1, value=3, maximum=8, step=1)
176
  interm_steps = gr.Slider(label = "num of intermediate images", minimum=3, value=21, maximum=65, step=2)
177
  guidance_scale = gr.Slider(
178
- label="Guidance scale",
179
- minimum=0.1,
180
- maximum=10.0,
181
- step=0.1,
182
- value=3.5,
183
- )
184
  randomize_seed = gr.Checkbox(True, label="Randomize seed")
185
  seed.render()
186
-
 
 
 
 
 
 
 
 
 
187
  submit.click(fn=generate,
188
  inputs=[concept_1, concept_2, x, prompt, randomize_seed, seed, recalc_directions, iterations, steps, interm_steps, guidance_scale, x_concept_1, x_concept_2, avg_diff_x, total_images],
189
  outputs=[x_concept_1, x_concept_2, avg_diff_x, output_image, image_seq, total_images, post_generation_image, post_generation_slider, seed])
 
126
  #strip, #gif{min-height: 50px}
127
  '''
128
  examples = [["winter", "summer", 1.25, "a dog in the park"], ["USA suburb", "Europe", 2, "a house"], ["rotten", "super fresh", 2, "a tomato"]]
129
+ image_seq = gr.Image(label="Strip", elem_id="strip", height=50)
130
+ output_image = gr.Image(label="Gif", elem_id="gif", height=50)
131
  post_generation_image = gr.Image(label="Generated Images")
132
  post_generation_slider = gr.Slider(minimum=-10, maximum=10, value=0, step=1)
133
  seed = gr.Slider(minimum=0, maximum=MAX_SEED, step=1, label="Seed", interactive=True, randomize=True)
 
152
  prompt = gr.Textbox(label="Prompt", info="Describe what you to be steered by the directions", placeholder="A dog in the park")
153
  x = gr.Slider(minimum=0, value=1.5, step=0.1, maximum=4.0, label="Strength", info="maximum strength on each direction (unstable beyond 2.5)")
154
  submit = gr.Button("Generate directions")
155
+
 
 
 
 
 
 
156
  with gr.Column():
157
  with gr.Group(elem_id="group"):
158
  post_generation_image.render()
 
169
  steps = gr.Slider(label = "num inference steps", minimum=1, value=3, maximum=8, step=1)
170
  interm_steps = gr.Slider(label = "num of intermediate images", minimum=3, value=21, maximum=65, step=2)
171
  guidance_scale = gr.Slider(
172
+ label="Guidance scale",
173
+ minimum=0.1,
174
+ maximum=10.0,
175
+ step=0.1,
176
+ value=3.5,
177
+ )
178
  randomize_seed = gr.Checkbox(True, label="Randomize seed")
179
  seed.render()
180
+
181
+ examples_gradio = gr.Examples(
182
+ examples=examples,
183
+ inputs=[prompt, concept_1, concept_2, x],
184
+ fn=generate,
185
+ outputs=[x_concept_1, x_concept_2, avg_diff_x, output_image, image_seq, total_images, post_generation_image, post_generation_slider, seed],
186
+ cache_examples="lazy"
187
+ )
188
+ examples_gradio.dataset._components = [concept_1, concept_2, prompt]
189
+
190
  submit.click(fn=generate,
191
  inputs=[concept_1, concept_2, x, prompt, randomize_seed, seed, recalc_directions, iterations, steps, interm_steps, guidance_scale, x_concept_1, x_concept_2, avg_diff_x, total_images],
192
  outputs=[x_concept_1, x_concept_2, avg_diff_x, output_image, image_seq, total_images, post_generation_image, post_generation_slider, seed])