File size: 1,027 Bytes
f19c435
ef4b074
 
b50bf6d
ef4b074
 
 
 
 
 
 
 
 
 
f19c435
 
 
 
 
 
 
 
 
 
 
 
067535e
 
 
f19c435
 
f33c5db
f19c435
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import gradio as gr
from diffusers import KandinskyPriorPipeline, KandinskyPipeline
from diffusers.utils import load_image
import torch


pipe_prior = KandinskyPriorPipeline.from_pretrained(
    "kandinsky-community/kandinsky-2-1-prior", torch_dtype=torch.float16
)
pipe_prior.to("cuda")

pipe = KandinskyPipeline.from_pretrained("kandinsky-community/kandinsky-2-1", torch_dtype=torch.float16)
pipe.to("cuda")


def blend(img1, img2, slider):
    return img1

with gr.Blocks() as demo:
    gr.Markdown("""
    # Image Blender
    by [Tony Assi](https://www.tonyassi.com/)
    """)
    
    with gr.Row():
        with gr.Column():
            img1 = gr.Image(label='Image 0', type='filepath')
            img2 = gr.Image(label='Image 1',type='filepath')
            slider = gr.Slider(label='Weight', maximum=1.0, value=0.5)
            btn = gr.Button("Blend")
        with gr.Column():
            output = gr.Image(label='Result')
    
    
    btn.click(fn=blend, inputs=[img1, img2, slider], outputs=output)

demo.launch()