Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -71,12 +71,6 @@ def clear_all_images():
|
|
71 |
for file in img_files:
|
72 |
os.remove(file)
|
73 |
|
74 |
-
|
75 |
-
# Add "Save All" button with emoji
|
76 |
-
save_all_button = gr.Button("💾 Save All", scale=1)
|
77 |
-
# Add "Clear All" button with emoji
|
78 |
-
clear_all_button = gr.Button("🗑️ Clear All", scale=1)
|
79 |
-
|
80 |
# Function to handle "Save All" button click
|
81 |
def save_all_button_click():
|
82 |
images = [file for file in os.listdir() if file.lower().endswith((".png", ".jpg", ".jpeg"))]
|
@@ -89,11 +83,6 @@ def save_all_button_click():
|
|
89 |
def clear_all_button_click():
|
90 |
clear_all_images()
|
91 |
|
92 |
-
# Add buttons to the Streamlit app
|
93 |
-
gr.button(save_all_button)
|
94 |
-
gr.button(clear_all_button)
|
95 |
-
|
96 |
-
|
97 |
|
98 |
|
99 |
|
@@ -205,6 +194,15 @@ css = """
|
|
205 |
"""
|
206 |
with gr.Blocks(css=css) as demo:
|
207 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
# Attach click event handlers to the buttons
|
209 |
save_all_button.click(save_all_button_click)
|
210 |
clear_all_button.click(clear_all_button_click)
|
|
|
71 |
for file in img_files:
|
72 |
os.remove(file)
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
# Function to handle "Save All" button click
|
75 |
def save_all_button_click():
|
76 |
images = [file for file in os.listdir() if file.lower().endswith((".png", ".jpg", ".jpeg"))]
|
|
|
83 |
def clear_all_button_click():
|
84 |
clear_all_images()
|
85 |
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
|
88 |
|
|
|
194 |
"""
|
195 |
with gr.Blocks(css=css) as demo:
|
196 |
|
197 |
+
# Add "Save All" button with emoji
|
198 |
+
save_all_button = gr.Button("💾 Save All", scale=1)
|
199 |
+
# Add "Clear All" button with emoji
|
200 |
+
clear_all_button = gr.Button("🗑️ Clear All", scale=1)
|
201 |
+
|
202 |
+
# Add buttons to the Streamlit app
|
203 |
+
gr.Button(save_all_button)
|
204 |
+
gr.Button(clear_all_button)
|
205 |
+
|
206 |
# Attach click event handlers to the buttons
|
207 |
save_all_button.click(save_all_button_click)
|
208 |
clear_all_button.click(clear_all_button_click)
|