tonyassi commited on
Commit
589ee95
β€’
1 Parent(s): f96e4e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -14,7 +14,17 @@ pipe.to("cuda")
14
 
15
 
16
  def blend(img1, img2, slider):
17
- return img1
 
 
 
 
 
 
 
 
 
 
18
 
19
  with gr.Blocks() as demo:
20
  gr.Markdown("""
@@ -24,8 +34,8 @@ with gr.Blocks() as demo:
24
 
25
  with gr.Row():
26
  with gr.Column():
27
- img1 = gr.Image(label='Image 0', type='filepath')
28
- img2 = gr.Image(label='Image 1',type='filepath')
29
  slider = gr.Slider(label='Weight', maximum=1.0, value=0.5)
30
  btn = gr.Button("Blend")
31
  with gr.Column():
 
14
 
15
 
16
  def blend(img1, img2, slider):
17
+ # add all the conditions we want to interpolate, can be either text or image
18
+ images_texts = [img1, img2]
19
+
20
+ # specify the weights for each condition in images_texts
21
+ weights = [slider, 1-slider]
22
+
23
+ prior_out = pipe_prior.interpolate(images_texts, weights)
24
+
25
+ image = pipe(prompt='', **prior_out, height=1024, width=1024).images[0]
26
+
27
+ return image
28
 
29
  with gr.Blocks() as demo:
30
  gr.Markdown("""
 
34
 
35
  with gr.Row():
36
  with gr.Column():
37
+ img1 = gr.Image(label='Image 0', type='pil')
38
+ img2 = gr.Image(label='Image 1',type='pil')
39
  slider = gr.Slider(label='Weight', maximum=1.0, value=0.5)
40
  btn = gr.Button("Blend")
41
  with gr.Column():