multimodalart HF staff commited on
Commit
db1abac
1 Parent(s): e1ad51f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -49,9 +49,9 @@ def convert_to_centered_scale(num):
49
  return tuple(range(start, end + 1))
50
 
51
  @spaces.GPU(duration=200)
52
- def generate(concept_1, concept_2, scale, prompt, seed, recalc_directions, iterations, steps, interm_steps, guidance_scale,
53
- x_concept_1, x_concept_2,
54
- avg_diff_x,
55
  img2img_type = None, img = None,
56
  controlnet_scale= None, ip_adapter_scale=None,
57
  total_images=[],
@@ -194,6 +194,7 @@ intro = """
194
  css='''
195
  #strip, #gif{min-height: 50px}
196
  '''
 
197
  with gr.Blocks(css=css) as demo:
198
 
199
  gr.HTML(intro)
@@ -219,7 +220,14 @@ with gr.Blocks(css=css) as demo:
219
  #slider_y = gr.Dropdown(label="Slider Y concept range", allow_custom_value=True, multiselect=True, max_choices=2)
220
  prompt = gr.Textbox(label="Prompt", placeholder="A dog in the park")
221
  x = gr.Slider(minimum=0, value=1.25, step=0.1, maximum=2.5, label="Strength", info="maximum strength on each direction")
222
- submit = gr.Button("find directions")
 
 
 
 
 
 
 
223
  with gr.Column():
224
  with gr.Group(elem_id="group"):
225
  post_generation_image = gr.Image(label="Generated Images")
 
49
  return tuple(range(start, end + 1))
50
 
51
  @spaces.GPU(duration=200)
52
+ def generate(concept_1, concept_2, scale, prompt, seed=42, recalc_directions=True, iterations=200, steps=4, interm_steps=9, guidance_scale=3.5,
53
+ x_concept_1="", x_concept_2="",
54
+ avg_diff_x=None,
55
  img2img_type = None, img = None,
56
  controlnet_scale= None, ip_adapter_scale=None,
57
  total_images=[],
 
194
  css='''
195
  #strip, #gif{min-height: 50px}
196
  '''
197
+ examples = [["winter", "summer", 1.25, "a dog in the park"]]
198
  with gr.Blocks(css=css) as demo:
199
 
200
  gr.HTML(intro)
 
220
  #slider_y = gr.Dropdown(label="Slider Y concept range", allow_custom_value=True, multiselect=True, max_choices=2)
221
  prompt = gr.Textbox(label="Prompt", placeholder="A dog in the park")
222
  x = gr.Slider(minimum=0, value=1.25, step=0.1, maximum=2.5, label="Strength", info="maximum strength on each direction")
223
+ submit = gr.Button("Generate directions")
224
+ gr.Examples(
225
+ examples=examples,
226
+ inputs=[concept_1, concept_2, prompt, x],
227
+ fn=generate,
228
+ outputs=[x, x_concept_1, x_concept_2, avg_diff_x, output_image, image_seq, total_images, post_generation_image, post_generation_slider],
229
+ cache_examples="lazy"
230
+ )
231
  with gr.Column():
232
  with gr.Group(elem_id="group"):
233
  post_generation_image = gr.Image(label="Generated Images")