File size: 827 Bytes
807d4f8
81e3fc5
 
807d4f8
81e3fc5
807d4f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from diffusers import DiffusionPipeline
import gradio as gr

generator = DiffusionPipeline.from_pretrained("kaveh/wsi_generator")

def generate(n_samples=1):
    images = []
    for i in range(n_samples):
        image = generator().images[0]
        images.append(image)
    return images
    
with gr.Blocks() as demo:
    with gr.Column(variant="panel"):
        with gr.Row(variant="compact"):
            n_s = gr.Slider(1, 4, label='Number of Samples', value=2, step=1.0, show_label=True).style(container=False)
            btn = gr.Button("Generate image").style(full_width=False)

        gallery = gr.Gallery(
            label="Generated images", show_label=False, elem_id="gallery").style(columns=[2], rows=[2], object_fit="contain", height="auto", preview=True)

    btn.click(generate, n_s, gallery)

demo.launch()