Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,7 +14,17 @@ pipe.to("cuda")
|
|
| 14 |
|
| 15 |
|
| 16 |
def blend(img1, img2, slider):
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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='
|
| 28 |
-
img2 = gr.Image(label='Image 1',type='
|
| 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():
|