Spaces:
Running
Running
smileycutie0
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -119,6 +119,7 @@ with gr.Blocks(
|
|
| 119 |
format="jpeg",
|
| 120 |
interactive=False
|
| 121 |
)
|
|
|
|
| 122 |
|
| 123 |
with gr.Accordion("ℹ️ About", open=False):
|
| 124 |
gr.Markdown(f"""
|
|
@@ -127,6 +128,9 @@ with gr.Blocks(
|
|
| 127 |
* Running on [Gradio](https://www.gradio.app) v{gr.__version__}
|
| 128 |
""")
|
| 129 |
|
|
|
|
|
|
|
|
|
|
| 130 |
def add_to_gallery(img, gallery):
|
| 131 |
if gallery is None:
|
| 132 |
gallery = []
|
|
@@ -134,8 +138,8 @@ with gr.Blocks(
|
|
| 134 |
gallery = gallery + [img]
|
| 135 |
return gallery
|
| 136 |
|
| 137 |
-
def
|
| 138 |
-
return
|
| 139 |
|
| 140 |
app.load(
|
| 141 |
update_examples,
|
|
@@ -153,6 +157,14 @@ with gr.Blocks(
|
|
| 153 |
show_api=False
|
| 154 |
)
|
| 155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
btn.click(
|
| 157 |
generate,
|
| 158 |
inputs=[prompt, seed, randomize_seed, width, height],
|
|
|
|
| 119 |
format="jpeg",
|
| 120 |
interactive=False
|
| 121 |
)
|
| 122 |
+
clear_btn = gr.Button("🗑️ Clear")
|
| 123 |
|
| 124 |
with gr.Accordion("ℹ️ About", open=False):
|
| 125 |
gr.Markdown(f"""
|
|
|
|
| 128 |
* Running on [Gradio](https://www.gradio.app) v{gr.__version__}
|
| 129 |
""")
|
| 130 |
|
| 131 |
+
def update_examples():
|
| 132 |
+
return gr.update(samples=load_examples())
|
| 133 |
+
|
| 134 |
def add_to_gallery(img, gallery):
|
| 135 |
if gallery is None:
|
| 136 |
gallery = []
|
|
|
|
| 138 |
gallery = gallery + [img]
|
| 139 |
return gallery
|
| 140 |
|
| 141 |
+
def clear_gallery():
|
| 142 |
+
return []
|
| 143 |
|
| 144 |
app.load(
|
| 145 |
update_examples,
|
|
|
|
| 157 |
show_api=False
|
| 158 |
)
|
| 159 |
|
| 160 |
+
clear_btn.click(
|
| 161 |
+
clear_gallery,
|
| 162 |
+
inputs=None,
|
| 163 |
+
outputs=[gallery],
|
| 164 |
+
queue=False,
|
| 165 |
+
show_api=False
|
| 166 |
+
)
|
| 167 |
+
|
| 168 |
btn.click(
|
| 169 |
generate,
|
| 170 |
inputs=[prompt, seed, randomize_seed, width, height],
|