Update app.py
Browse files
app.py
CHANGED
@@ -84,7 +84,6 @@ textarea.light-mode, input.light-mode {
|
|
84 |
border-radius: 12px;
|
85 |
margin-top: 20px;
|
86 |
}
|
87 |
-
|
88 |
/* Neon Button Styling */
|
89 |
button {
|
90 |
font-size: 1.2rem;
|
@@ -101,20 +100,32 @@ button {
|
|
101 |
animation: neon-button 2s infinite;
|
102 |
transition: transform 0.3s;
|
103 |
}
|
104 |
-
|
105 |
button:hover {
|
106 |
transform: scale(1.1);
|
107 |
box-shadow: 0 0 20px rgba(255, 255, 255, 0.8),
|
108 |
0 0 40px rgba(255, 255, 255, 0.6),
|
109 |
0 0 60px rgba(255, 255, 255, 0.4);
|
110 |
}
|
111 |
-
|
112 |
/* Neon Animation */
|
113 |
@keyframes neon-button {
|
114 |
0% { background-position: 0%; }
|
115 |
100% { background-position: 400%; }
|
116 |
}
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
@media screen and (max-width: 768px) {
|
119 |
.gradio-container {
|
120 |
padding: 10px;
|
@@ -147,6 +158,25 @@ document.addEventListener('DOMContentLoaded', function () {
|
|
147 |
};
|
148 |
document.body.prepend(toggleButton);
|
149 |
document.body.classList.add('light-mode'); // Default to light mode
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
});
|
151 |
</script>
|
152 |
"""
|
@@ -166,6 +196,7 @@ with gr.Blocks(css=custom_css) as interface:
|
|
166 |
Back_cover_prompt = gr.Textbox(label="Mobile type", placeholder="E.g., iPhone, Samsung", elem_id="component-2")
|
167 |
design_prompt = gr.Textbox(label="Design Details", placeholder="E.g., Bold stripes with geometric patterns", elem_id="component-3")
|
168 |
generate_button = gr.Button("Generate Design")
|
|
|
169 |
with gr.Column(scale=1, min_width=300):
|
170 |
output = gr.Image(label="Generated Design", elem_id="output-image")
|
171 |
|
|
|
84 |
border-radius: 12px;
|
85 |
margin-top: 20px;
|
86 |
}
|
|
|
87 |
/* Neon Button Styling */
|
88 |
button {
|
89 |
font-size: 1.2rem;
|
|
|
100 |
animation: neon-button 2s infinite;
|
101 |
transition: transform 0.3s;
|
102 |
}
|
|
|
103 |
button:hover {
|
104 |
transform: scale(1.1);
|
105 |
box-shadow: 0 0 20px rgba(255, 255, 255, 0.8),
|
106 |
0 0 40px rgba(255, 255, 255, 0.6),
|
107 |
0 0 60px rgba(255, 255, 255, 0.4);
|
108 |
}
|
|
|
109 |
/* Neon Animation */
|
110 |
@keyframes neon-button {
|
111 |
0% { background-position: 0%; }
|
112 |
100% { background-position: 400%; }
|
113 |
}
|
114 |
+
/* Loading Spinner */
|
115 |
+
#loading-spinner {
|
116 |
+
display: none;
|
117 |
+
margin: 20px auto;
|
118 |
+
border: 6px solid #f3f3f3;
|
119 |
+
border-top: 6px solid #3498db;
|
120 |
+
border-radius: 50%;
|
121 |
+
width: 50px;
|
122 |
+
height: 50px;
|
123 |
+
animation: spin 1s linear infinite;
|
124 |
+
}
|
125 |
+
@keyframes spin {
|
126 |
+
0% { transform: rotate(0deg); }
|
127 |
+
100% { transform: rotate(360deg); }
|
128 |
+
}
|
129 |
@media screen and (max-width: 768px) {
|
130 |
.gradio-container {
|
131 |
padding: 10px;
|
|
|
158 |
};
|
159 |
document.body.prepend(toggleButton);
|
160 |
document.body.classList.add('light-mode'); // Default to light mode
|
161 |
+
|
162 |
+
// Dynamic Welcome Message
|
163 |
+
const welcomeMessage = document.createElement('h2');
|
164 |
+
const currentHour = new Date().getHours();
|
165 |
+
let greeting = "Welcome!";
|
166 |
+
if (currentHour < 12) greeting = "Good Morning!";
|
167 |
+
else if (currentHour < 18) greeting = "Good Afternoon!";
|
168 |
+
else greeting = "Good Evening!";
|
169 |
+
welcomeMessage.textContent = greeting + " Customize your phone cover!";
|
170 |
+
welcomeMessage.style.textAlign = "center";
|
171 |
+
document.body.prepend(welcomeMessage);
|
172 |
+
|
173 |
+
// Add spinner toggle on button click
|
174 |
+
const generateButton = document.querySelector('button:contains("Generate Design")');
|
175 |
+
const spinner = document.getElementById('loading-spinner');
|
176 |
+
generateButton.onclick = () => {
|
177 |
+
spinner.style.display = 'block';
|
178 |
+
setTimeout(() => spinner.style.display = 'none', 5000); // Mock loading
|
179 |
+
};
|
180 |
});
|
181 |
</script>
|
182 |
"""
|
|
|
196 |
Back_cover_prompt = gr.Textbox(label="Mobile type", placeholder="E.g., iPhone, Samsung", elem_id="component-2")
|
197 |
design_prompt = gr.Textbox(label="Design Details", placeholder="E.g., Bold stripes with geometric patterns", elem_id="component-3")
|
198 |
generate_button = gr.Button("Generate Design")
|
199 |
+
spinner = gr.HTML('<div id="loading-spinner"></div>')
|
200 |
with gr.Column(scale=1, min_width=300):
|
201 |
output = gr.Image(label="Generated Design", elem_id="output-image")
|
202 |
|