Update run.py
Browse files
run.py
CHANGED
@@ -5,10 +5,6 @@ import random
|
|
5 |
|
6 |
import gradio as gr
|
7 |
|
8 |
-
examples = [
|
9 |
-
"examples/vermeer.jpg",
|
10 |
-
"examples/matisse.jpg",
|
11 |
-
]
|
12 |
|
13 |
def fake_gan():
|
14 |
images = [
|
@@ -23,9 +19,10 @@ def fake_gan():
|
|
23 |
), f"label {i}" if i != 0 else "label" * 50)
|
24 |
for i in range(3)
|
25 |
]
|
26 |
-
return
|
27 |
-
|
28 |
-
|
|
|
29 |
with gr.Blocks() as demo:
|
30 |
with gr.Column(variant="panel"):
|
31 |
with gr.Row(variant="compact"):
|
@@ -38,11 +35,12 @@ with gr.Blocks() as demo:
|
|
38 |
container=False,
|
39 |
)
|
40 |
btn = gr.Button("Generate image").style(full_width=False)
|
|
|
41 |
gallery = gr.Gallery(
|
42 |
label="Generated images", show_label=False, elem_id="gallery"
|
43 |
).style(grid=[2], height="auto")
|
44 |
-
|
45 |
-
btn.click(fake_gan, None,
|
46 |
|
47 |
if __name__ == "__main__":
|
48 |
demo.launch()
|
|
|
5 |
|
6 |
import gradio as gr
|
7 |
|
|
|
|
|
|
|
|
|
8 |
|
9 |
def fake_gan():
|
10 |
images = [
|
|
|
19 |
), f"label {i}" if i != 0 else "label" * 50)
|
20 |
for i in range(3)
|
21 |
]
|
22 |
+
return images
|
23 |
+
|
24 |
+
out = gr.outputs.Image(type="pil", label="Output Image",value="https://images.unsplash.com/photo-1601412436009-d964bd02edbc?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=464&q=80")
|
25 |
+
|
26 |
with gr.Blocks() as demo:
|
27 |
with gr.Column(variant="panel"):
|
28 |
with gr.Row(variant="compact"):
|
|
|
35 |
container=False,
|
36 |
)
|
37 |
btn = gr.Button("Generate image").style(full_width=False)
|
38 |
+
|
39 |
gallery = gr.Gallery(
|
40 |
label="Generated images", show_label=False, elem_id="gallery"
|
41 |
).style(grid=[2], height="auto")
|
42 |
+
|
43 |
+
btn.click(fake_gan, None, out,api_name='testing')
|
44 |
|
45 |
if __name__ == "__main__":
|
46 |
demo.launch()
|