Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -185,7 +185,6 @@ def generate_images():
|
|
| 185 |
"--seeds=3-5,7,9,12-14,16-26,29,31,32,34,40,41",
|
| 186 |
f"--network={MODEL_PATH}"
|
| 187 |
]
|
| 188 |
-
|
| 189 |
try:
|
| 190 |
subprocess.run(command, check=True, capture_output=True, text=True)
|
| 191 |
except subprocess.CalledProcessError as e:
|
|
@@ -223,27 +222,24 @@ with gr.Blocks() as demo:
|
|
| 223 |
file_paths = []
|
| 224 |
|
| 225 |
with gr.Row():
|
| 226 |
-
for
|
| 227 |
-
with gr.Column():
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
with gr.Column():
|
| 231 |
-
img = gr.Image(width=200, height=200)
|
| 232 |
-
image_components.append(img)
|
| 233 |
|
| 234 |
-
|
| 235 |
-
|
| 236 |
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
|
| 241 |
-
|
| 242 |
-
|
| 243 |
|
| 244 |
def generate_and_display_images():
|
| 245 |
image_paths = get_random_images()
|
| 246 |
-
return image_paths + image_paths # for
|
| 247 |
|
| 248 |
generate_button.click(
|
| 249 |
fn=generate_and_display_images,
|
|
@@ -252,4 +248,3 @@ with gr.Blocks() as demo:
|
|
| 252 |
|
| 253 |
if __name__ == "__main__":
|
| 254 |
demo.launch()
|
| 255 |
-
|
|
|
|
| 185 |
"--seeds=3-5,7,9,12-14,16-26,29,31,32,34,40,41",
|
| 186 |
f"--network={MODEL_PATH}"
|
| 187 |
]
|
|
|
|
| 188 |
try:
|
| 189 |
subprocess.run(command, check=True, capture_output=True, text=True)
|
| 190 |
except subprocess.CalledProcessError as e:
|
|
|
|
| 222 |
file_paths = []
|
| 223 |
|
| 224 |
with gr.Row():
|
| 225 |
+
for i in range(10): # 10 images
|
| 226 |
+
with gr.Column(scale=1):
|
| 227 |
+
img = gr.Image(width=200, height=200)
|
| 228 |
+
image_components.append(img)
|
|
|
|
|
|
|
|
|
|
| 229 |
|
| 230 |
+
file_path = gr.Textbox(visible=False)
|
| 231 |
+
file_paths.append(file_path)
|
| 232 |
|
| 233 |
+
save_btn = gr.Button("💾 Save")
|
| 234 |
+
output = gr.Textbox(visible=False)
|
| 235 |
+
outputs.append(output)
|
| 236 |
|
| 237 |
+
save_btn.click(fn=save_image, inputs=file_path, outputs=output)
|
| 238 |
+
save_buttons.append(save_btn)
|
| 239 |
|
| 240 |
def generate_and_display_images():
|
| 241 |
image_paths = get_random_images()
|
| 242 |
+
return image_paths + image_paths # one set for images, one for hidden file paths
|
| 243 |
|
| 244 |
generate_button.click(
|
| 245 |
fn=generate_and_display_images,
|
|
|
|
| 248 |
|
| 249 |
if __name__ == "__main__":
|
| 250 |
demo.launch()
|
|
|