Spaces:
Sleeping
Sleeping
added wsi generator model
Browse files
app.py
CHANGED
@@ -1,7 +1,24 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from diffusers import DiffusionPipeline
|
2 |
import gradio as gr
|
3 |
|
4 |
+
generator = DiffusionPipeline.from_pretrained("kaveh/wsi_generator")
|
|
|
5 |
|
6 |
+
def generate(n_samples=1):
|
7 |
+
images = []
|
8 |
+
for i in range(n_samples):
|
9 |
+
image = generator().images[0]
|
10 |
+
images.append(image)
|
11 |
+
return images
|
12 |
+
|
13 |
+
with gr.Blocks() as demo:
|
14 |
+
with gr.Column(variant="panel"):
|
15 |
+
with gr.Row(variant="compact"):
|
16 |
+
n_s = gr.Slider(1, 4, label='Number of Samples', value=2, step=1.0, show_label=True).style(container=False)
|
17 |
+
btn = gr.Button("Generate image").style(full_width=False)
|
18 |
+
|
19 |
+
gallery = gr.Gallery(
|
20 |
+
label="Generated images", show_label=False, elem_id="gallery").style(columns=[2], rows=[2], object_fit="contain", height="auto", preview=True)
|
21 |
+
|
22 |
+
btn.click(generate, n_s, gallery)
|
23 |
+
|
24 |
+
demo.launch()
|