Spaces:
Runtime error
Runtime error
alvanli
commited on
Commit
•
cf2717f
1
Parent(s):
f6cec28
Added sample
Browse files
app.py
CHANGED
@@ -22,6 +22,13 @@ def main():
|
|
22 |
with torch.no_grad():
|
23 |
imgs = generate_images(dog_path if fn_is_dog else human_path, 2, 1)
|
24 |
return imgs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
with gr.Blocks() as demo:
|
27 |
gr.HTML("""
|
@@ -41,6 +48,7 @@ def main():
|
|
41 |
interactive=True
|
42 |
)
|
43 |
generate_button = gr.Button("Generate")
|
|
|
44 |
|
45 |
with gr.Row():
|
46 |
g1 = gr.Gallery(
|
@@ -59,6 +67,12 @@ def main():
|
|
59 |
outputs=[g1, g2]
|
60 |
)
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
demo.queue(concurrency_count=1)
|
63 |
demo.launch(share=False, server_name="0.0.0.0")
|
64 |
|
|
|
22 |
with torch.no_grad():
|
23 |
imgs = generate_images(dog_path if fn_is_dog else human_path, 2, 1)
|
24 |
return imgs
|
25 |
+
|
26 |
+
def load_examples():
|
27 |
+
torch.manual_seed(32)
|
28 |
+
# print(fn_is_dog)
|
29 |
+
with torch.no_grad():
|
30 |
+
imgs = generate_images(dog_path, 2, 1)
|
31 |
+
return 32, 1, imgs[0], imgs[1]
|
32 |
|
33 |
with gr.Blocks() as demo:
|
34 |
gr.HTML("""
|
|
|
48 |
interactive=True
|
49 |
)
|
50 |
generate_button = gr.Button("Generate")
|
51 |
+
sample_button = gr.Button("Load Example")
|
52 |
|
53 |
with gr.Row():
|
54 |
g1 = gr.Gallery(
|
|
|
67 |
outputs=[g1, g2]
|
68 |
)
|
69 |
|
70 |
+
sample_button.click(
|
71 |
+
fn=load_examples,
|
72 |
+
inputs=[],
|
73 |
+
outputs=[seed, is_dog, 1, g2]
|
74 |
+
)
|
75 |
+
|
76 |
demo.queue(concurrency_count=1)
|
77 |
demo.launch(share=False, server_name="0.0.0.0")
|
78 |
|