linoyts HF staff commited on
Commit
6c3f8be
1 Parent(s): 79bd7e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -17,11 +17,11 @@ def generate(slider_x, slider_y, prompt, iterations, steps,
17
 
18
  # check if avg diff for directions need to be re-calculated
19
  if not sorted(slider_x) == sorted([x_concept_1, x_concept_2]):
20
- avg_diff = clip_slider.find_latent_direction(slider_x[0], slider_x[1], iterations=iterations)
21
  x_concept_1, x_concept_2 = slider_x[0], slider_x[1]
22
 
23
  if not sorted(slider_y) == sorted([y_concept_1, y_concept_2]):
24
- avg_diff_2nd = clip_slider.find_latent_direction(slider_y[0], slider_y[1], iterations=iterations)
25
  y_concept_1, y_concept_2 = slider_y[0], slider_y[1]
26
 
27
  image = clip_slider.generate(prompt, scale=0, scale_2nd=0, num_inference_steps=steps, avg_diff=avg_diff, avg_diff_2nd=avg_diff_2nd)
@@ -95,7 +95,8 @@ with gr.Blocks(css=css) as demo:
95
  x = gr.Slider(minimum=-10, value=0, maximum=10, elem_id="x", interactive=False)
96
  y = gr.Slider(minimum=-10, value=0, maximum=10, elem_id="y", interactive=False)
97
  output_image = gr.Image(elem_id="image_out")
98
- with gr.Accordion(label="advanced options"):
 
99
  iterations = gr.Slider(label = "num iterations", minimum=0, value=100, maximum=300)
100
  steps = gr.Slider(label = "num inference steps", minimum=1, value=8, maximum=30)
101
 
 
17
 
18
  # check if avg diff for directions need to be re-calculated
19
  if not sorted(slider_x) == sorted([x_concept_1, x_concept_2]):
20
+ avg_diff = clip_slider.find_latent_direction(slider_x[0], slider_x[1], num_iterations=iterations)
21
  x_concept_1, x_concept_2 = slider_x[0], slider_x[1]
22
 
23
  if not sorted(slider_y) == sorted([y_concept_1, y_concept_2]):
24
+ avg_diff_2nd = clip_slider.find_latent_direction(slider_y[0], slider_y[1], num_iterations=iterations)
25
  y_concept_1, y_concept_2 = slider_y[0], slider_y[1]
26
 
27
  image = clip_slider.generate(prompt, scale=0, scale_2nd=0, num_inference_steps=steps, avg_diff=avg_diff, avg_diff_2nd=avg_diff_2nd)
 
95
  x = gr.Slider(minimum=-10, value=0, maximum=10, elem_id="x", interactive=False)
96
  y = gr.Slider(minimum=-10, value=0, maximum=10, elem_id="y", interactive=False)
97
  output_image = gr.Image(elem_id="image_out")
98
+
99
+ with gr.Accordion(label="advanced options", open=False):
100
  iterations = gr.Slider(label = "num iterations", minimum=0, value=100, maximum=300)
101
  steps = gr.Slider(label = "num inference steps", minimum=1, value=8, maximum=30)
102