Update app.py
Browse files
app.py
CHANGED
@@ -54,7 +54,7 @@ def save_design(image):
|
|
54 |
def fetch_saved_designs():
|
55 |
saved_designs_dir = "saved_designs"
|
56 |
if not os.path.exists(saved_designs_dir):
|
57 |
-
return [
|
58 |
|
59 |
designs = []
|
60 |
for file_name in os.listdir(saved_designs_dir):
|
@@ -120,7 +120,12 @@ with gr.Blocks(css=custom_css) as interface:
|
|
120 |
with gr.Tab("Home"):
|
121 |
gr.Markdown("Welcome to the **AI Phone Cover Designer**! Below are some of your saved designs.")
|
122 |
saved_images_gallery = gr.Gallery(label="Saved Designs")
|
123 |
-
|
|
|
|
|
|
|
|
|
|
|
124 |
|
125 |
with gr.Tab("Design"):
|
126 |
with gr.Row():
|
@@ -162,4 +167,4 @@ with gr.Blocks(css=custom_css) as interface:
|
|
162 |
""")
|
163 |
|
164 |
# Launch the app
|
165 |
-
interface.launch(debug=True)
|
|
|
54 |
def fetch_saved_designs():
|
55 |
saved_designs_dir = "saved_designs"
|
56 |
if not os.path.exists(saved_designs_dir):
|
57 |
+
return []
|
58 |
|
59 |
designs = []
|
60 |
for file_name in os.listdir(saved_designs_dir):
|
|
|
120 |
with gr.Tab("Home"):
|
121 |
gr.Markdown("Welcome to the **AI Phone Cover Designer**! Below are some of your saved designs.")
|
122 |
saved_images_gallery = gr.Gallery(label="Saved Designs")
|
123 |
+
|
124 |
+
# Load the saved designs dynamically when the tab is rendered
|
125 |
+
def display_saved_designs():
|
126 |
+
return fetch_saved_designs()
|
127 |
+
|
128 |
+
saved_images_gallery.render(value=fetch_saved_designs())
|
129 |
|
130 |
with gr.Tab("Design"):
|
131 |
with gr.Row():
|
|
|
167 |
""")
|
168 |
|
169 |
# Launch the app
|
170 |
+
interface.launch(debug=True)
|