Update app.py
Browse files
app.py
CHANGED
@@ -48,15 +48,40 @@ def save_design(image):
|
|
48 |
image.save(file_path)
|
49 |
return f"Design saved as {file_path}!"
|
50 |
|
51 |
-
#
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
# Custom CSS for animations
|
62 |
custom_css = """
|
@@ -95,18 +120,7 @@ with gr.Blocks(css=custom_css) as interface:
|
|
95 |
with gr.Tab("Home"):
|
96 |
gr.Markdown("### Welcome to the **AI Phone Cover Designer**!")
|
97 |
gr.Markdown("Below is a carousel showcasing some of the saved designs.")
|
98 |
-
|
99 |
-
# Carousel to display saved designs
|
100 |
-
design_carousel = gr.Carousel(
|
101 |
-
items=fetch_saved_designs_with_captions(),
|
102 |
-
item_width=300,
|
103 |
-
item_height=400,
|
104 |
-
item_spacing=10,
|
105 |
-
loop=True,
|
106 |
-
autoplay=True,
|
107 |
-
autoplay_interval=3000,
|
108 |
-
label="Saved Designs Carousel",
|
109 |
-
)
|
110 |
|
111 |
with gr.Tab("Design"):
|
112 |
with gr.Row():
|
|
|
48 |
image.save(file_path)
|
49 |
return f"Design saved as {file_path}!"
|
50 |
|
51 |
+
# HTML-based carousel content
|
52 |
+
carousel_html = """
|
53 |
+
<div class="carousel">
|
54 |
+
<div class="slides">
|
55 |
+
<img src="https://via.placeholder.com/300x400.png?text=Design+1" alt="Design 1">
|
56 |
+
<img src="https://via.placeholder.com/300x400.png?text=Design+2" alt="Design 2">
|
57 |
+
<img src="https://via.placeholder.com/300x400.png?text=Design+3" alt="Design 3">
|
58 |
+
</div>
|
59 |
+
</div>
|
60 |
+
<style>
|
61 |
+
.carousel {
|
62 |
+
display: flex;
|
63 |
+
overflow: hidden;
|
64 |
+
width: 100%;
|
65 |
+
max-width: 800px;
|
66 |
+
margin: 0 auto;
|
67 |
+
}
|
68 |
+
.slides {
|
69 |
+
display: flex;
|
70 |
+
transition: transform 0.5s ease-in-out;
|
71 |
+
animation: slide 10s infinite;
|
72 |
+
}
|
73 |
+
.slides img {
|
74 |
+
width: 300px;
|
75 |
+
height: 400px;
|
76 |
+
margin: 0 10px;
|
77 |
+
}
|
78 |
+
@keyframes slide {
|
79 |
+
0%, 20% { transform: translateX(0); }
|
80 |
+
40%, 60% { transform: translateX(-320px); }
|
81 |
+
80%, 100% { transform: translateX(-640px); }
|
82 |
+
}
|
83 |
+
</style>
|
84 |
+
"""
|
85 |
|
86 |
# Custom CSS for animations
|
87 |
custom_css = """
|
|
|
120 |
with gr.Tab("Home"):
|
121 |
gr.Markdown("### Welcome to the **AI Phone Cover Designer**!")
|
122 |
gr.Markdown("Below is a carousel showcasing some of the saved designs.")
|
123 |
+
gr.HTML(carousel_html)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
|
125 |
with gr.Tab("Design"):
|
126 |
with gr.Row():
|