Update app.py
Browse files
app.py
CHANGED
@@ -121,7 +121,6 @@ with gr.Blocks() as demo:
|
|
121 |
|
122 |
add_button = gr.Button("Add Object")
|
123 |
|
124 |
-
|
125 |
# Advanced settings in a collapsible accordion
|
126 |
with gr.Accordion("Advanced Settings", open=False):
|
127 |
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0)
|
@@ -144,10 +143,10 @@ with gr.Blocks() as demo:
|
|
144 |
)
|
145 |
|
146 |
generate_button = gr.Button("Generate Image")
|
147 |
-
|
148 |
result = gr.Image(label="Generated Image")
|
149 |
-
|
150 |
-
|
|
|
151 |
|
152 |
# Submit the prompt and update the display
|
153 |
submit_button.click(
|
@@ -163,13 +162,6 @@ with gr.Blocks() as demo:
|
|
163 |
outputs=[objects_display]
|
164 |
)
|
165 |
|
166 |
-
# Refresh button to clear arrays and reset inputs
|
167 |
-
refresh_button.click(
|
168 |
-
fn=clear_arrays,
|
169 |
-
inputs=None,
|
170 |
-
outputs=[objects_display, prompt]
|
171 |
-
)
|
172 |
-
|
173 |
# Generate image based on added objects
|
174 |
generate_button.click(
|
175 |
fn=generate_image,
|
@@ -177,5 +169,12 @@ with gr.Blocks() as demo:
|
|
177 |
outputs=[result, seed]
|
178 |
)
|
179 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
if __name__ == "__main__":
|
181 |
demo.launch()
|
|
|
121 |
|
122 |
add_button = gr.Button("Add Object")
|
123 |
|
|
|
124 |
# Advanced settings in a collapsible accordion
|
125 |
with gr.Accordion("Advanced Settings", open=False):
|
126 |
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0)
|
|
|
143 |
)
|
144 |
|
145 |
generate_button = gr.Button("Generate Image")
|
|
|
146 |
result = gr.Image(label="Generated Image")
|
147 |
+
|
148 |
+
# Refresh button to clear arrays and reset inputs (moved below the result)
|
149 |
+
refresh_button = gr.Button("Refresh")
|
150 |
|
151 |
# Submit the prompt and update the display
|
152 |
submit_button.click(
|
|
|
162 |
outputs=[objects_display]
|
163 |
)
|
164 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
# Generate image based on added objects
|
166 |
generate_button.click(
|
167 |
fn=generate_image,
|
|
|
169 |
outputs=[result, seed]
|
170 |
)
|
171 |
|
172 |
+
# Refresh button to clear arrays and reset inputs
|
173 |
+
refresh_button.click(
|
174 |
+
fn=clear_arrays,
|
175 |
+
inputs=None,
|
176 |
+
outputs=[objects_display, prompt]
|
177 |
+
)
|
178 |
+
|
179 |
if __name__ == "__main__":
|
180 |
demo.launch()
|