Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -98,12 +98,9 @@ def save_all_images(images):
|
|
| 98 |
# remove?
|
| 99 |
zip_base64 = encode_file_to_base64(zip_filename) # Encode the zip file to base64
|
| 100 |
download_link = f'<a href="data:application/zip;base64,{zip_base64}" download="{zip_filename}">Download All</a>'
|
| 101 |
-
gr.File(link=download_link)
|
| 102 |
-
print(download_link)
|
| 103 |
-
gr.HTML(download_link)
|
| 104 |
-
redirect_button = gr.Button("Clear", variant='secondary')
|
| 105 |
-
redirect_button.click(None, None,None, _js="window.location.assign('https://google.com');")
|
| 106 |
|
|
|
|
|
|
|
| 107 |
|
| 108 |
return zip_filename, download_link
|
| 109 |
|
|
@@ -112,18 +109,18 @@ def save_all_button_click():
|
|
| 112 |
images = [file for file in os.listdir() if file.lower().endswith((".png", ".jpg", ".jpeg"))]
|
| 113 |
zip_filename, download_link = save_all_images(images)
|
| 114 |
if zip_filename:
|
|
|
|
| 115 |
gr.Button(link=zip_filename)
|
|
|
|
| 116 |
if download_link:
|
|
|
|
| 117 |
gr.HTML(download_link)
|
| 118 |
-
|
| 119 |
|
| 120 |
# Function to handle "Clear All" button click
|
| 121 |
def clear_all_button_click():
|
| 122 |
clear_all_images()
|
| 123 |
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
print(f"SAFETY_CHECKER: {SAFETY_CHECKER}")
|
| 128 |
print(f"TORCH_COMPILE: {TORCH_COMPILE}")
|
| 129 |
print(f"device: {device}")
|
|
@@ -313,5 +310,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 313 |
save_all_button.click(save_all_button_click)
|
| 314 |
clear_all_button.click(clear_all_button_click)
|
| 315 |
|
|
|
|
|
|
|
| 316 |
demo.queue()
|
| 317 |
demo.launch()
|
|
|
|
| 98 |
# remove?
|
| 99 |
zip_base64 = encode_file_to_base64(zip_filename) # Encode the zip file to base64
|
| 100 |
download_link = f'<a href="data:application/zip;base64,{zip_base64}" download="{zip_filename}">Download All</a>'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
+
# redirect_button = gr.Button("Clear", variant='secondary')
|
| 103 |
+
# redirect_button.click(None, None,None, _js="window.location.assign('https://google.com');")
|
| 104 |
|
| 105 |
return zip_filename, download_link
|
| 106 |
|
|
|
|
| 109 |
images = [file for file in os.listdir() if file.lower().endswith((".png", ".jpg", ".jpeg"))]
|
| 110 |
zip_filename, download_link = save_all_images(images)
|
| 111 |
if zip_filename:
|
| 112 |
+
print(zip_filename)
|
| 113 |
gr.Button(link=zip_filename)
|
| 114 |
+
gr.File(value=zip_filename)
|
| 115 |
if download_link:
|
| 116 |
+
print(download_link)
|
| 117 |
gr.HTML(download_link)
|
| 118 |
+
gr.Button(link=download_link)
|
| 119 |
|
| 120 |
# Function to handle "Clear All" button click
|
| 121 |
def clear_all_button_click():
|
| 122 |
clear_all_images()
|
| 123 |
|
|
|
|
|
|
|
|
|
|
| 124 |
print(f"SAFETY_CHECKER: {SAFETY_CHECKER}")
|
| 125 |
print(f"TORCH_COMPILE: {TORCH_COMPILE}")
|
| 126 |
print(f"device: {device}")
|
|
|
|
| 310 |
save_all_button.click(save_all_button_click)
|
| 311 |
clear_all_button.click(clear_all_button_click)
|
| 312 |
|
| 313 |
+
|
| 314 |
+
|
| 315 |
demo.queue()
|
| 316 |
demo.launch()
|