linoyts HF staff commited on
Commit
64b9ad0
1 Parent(s): 0c5d517

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -35,12 +35,14 @@ def generate(slider_x, slider_y, prompt,
35
 
36
  return gr.update(label=comma_concepts_x, interactive=True),gr.update(label=comma_concepts_y, interactive=True), x_concept_1, x_concept_2, y_concept_1, y_concept_2, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2, image
37
 
 
38
  def update_x(x,y,prompt, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2):
39
  avg_diff = [avg_diff_x_1.cuda(), avg_diff_x_2.cuda()]
40
  avg_diff_2nd = [avg_diff_y_1.cuda(), avg_diff_y_2.cuda()]
41
  image = clip_slider.generate(prompt, scale=x, scale_2nd=y, num_inference_steps=8, avg_diff=avg_diff,avg_diff_2nd=avg_diff_2nd)
42
  return image
43
 
 
44
  def update_y(x,y,prompt, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2):
45
  avg_diff = [avg_diff_x_1.cuda(), avg_diff_x_2.cuda()]
46
  avg_diff_2nd = [avg_diff_y_1.cuda(), avg_diff_y_2.cuda()]
 
35
 
36
  return gr.update(label=comma_concepts_x, interactive=True),gr.update(label=comma_concepts_y, interactive=True), x_concept_1, x_concept_2, y_concept_1, y_concept_2, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2, image
37
 
38
+ @spaces.GPU
39
  def update_x(x,y,prompt, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2):
40
  avg_diff = [avg_diff_x_1.cuda(), avg_diff_x_2.cuda()]
41
  avg_diff_2nd = [avg_diff_y_1.cuda(), avg_diff_y_2.cuda()]
42
  image = clip_slider.generate(prompt, scale=x, scale_2nd=y, num_inference_steps=8, avg_diff=avg_diff,avg_diff_2nd=avg_diff_2nd)
43
  return image
44
 
45
+ @spaces.GPU
46
  def update_y(x,y,prompt, avg_diff_x_1, avg_diff_x_2, avg_diff_y_1, avg_diff_y_2):
47
  avg_diff = [avg_diff_x_1.cuda(), avg_diff_x_2.cuda()]
48
  avg_diff_2nd = [avg_diff_y_1.cuda(), avg_diff_y_2.cuda()]