Update app.py
Browse files
app.py
CHANGED
@@ -46,101 +46,73 @@ def infer(color_prompt, Phone_type_prompt, design_prompt):
|
|
46 |
print("API Error:", response.status_code)
|
47 |
raise Exception(f"API Error: {response.status_code}")
|
48 |
|
49 |
-
#
|
50 |
custom_css = """
|
51 |
body {
|
52 |
font-family: 'Poppins', sans-serif;
|
53 |
-
background-color: #f8f9fa;
|
54 |
margin: 0;
|
55 |
padding: 0;
|
|
|
56 |
}
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
}
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
max-width: 1200px;
|
65 |
-
margin: auto;
|
66 |
-
padding: 20px;
|
67 |
-
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
68 |
-
border-radius: 12px;
|
69 |
-
background: white;
|
70 |
-
position: relative;
|
71 |
}
|
72 |
-
|
73 |
button {
|
74 |
font-size: 1.2rem;
|
75 |
padding: 10px 20px;
|
76 |
-
background-color: #007bff;
|
77 |
-
border: none;
|
78 |
-
color: white;
|
79 |
border-radius: 5px;
|
80 |
cursor: pointer;
|
81 |
transition: 0.3s all;
|
82 |
-
box-shadow: 0px 8px 15px rgba(0, 123, 255, 0.2);
|
83 |
}
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
box-shadow: 0px 15px 20px rgba(0, 123, 255, 0.4);
|
88 |
-
transform: translateY(-2px);
|
89 |
}
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
border-radius: 8px;
|
94 |
-
padding: 10px;
|
95 |
-
font-size: 1rem;
|
96 |
}
|
97 |
-
|
98 |
-
textarea:focus {
|
99 |
-
border-color: #007bff;
|
100 |
-
}
|
101 |
-
|
102 |
-
.gr-input {
|
103 |
padding: 10px;
|
104 |
-
border: 2px solid #ccc;
|
105 |
border-radius: 8px;
|
106 |
transition: 0.3s;
|
107 |
}
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
112 |
}
|
113 |
-
|
114 |
.output-image {
|
115 |
max-width: 100%;
|
116 |
border-radius: 12px;
|
117 |
border: 2px solid #007bff;
|
118 |
-
|
119 |
-
|
120 |
-
.flashy-btn {
|
121 |
-
animation: flash 1.5s infinite;
|
122 |
-
}
|
123 |
-
|
124 |
-
@keyframes flash {
|
125 |
-
0%, 100% {
|
126 |
-
box-shadow: 0 0 10px #007bff, 0 0 40px #007bff, 0 0 80px #007bff;
|
127 |
-
}
|
128 |
-
50% {
|
129 |
-
box-shadow: 0 0 20px #0056b3, 0 0 50px #0056b3, 0 0 100px #0056b3;
|
130 |
-
}
|
131 |
}
|
132 |
"""
|
133 |
|
|
|
134 |
custom_js = """
|
135 |
<script>
|
136 |
document.addEventListener('DOMContentLoaded', function () {
|
137 |
-
const
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
}
|
|
|
|
|
144 |
});
|
145 |
</script>
|
146 |
"""
|
|
|
46 |
print("API Error:", response.status_code)
|
47 |
raise Exception(f"API Error: {response.status_code}")
|
48 |
|
49 |
+
# Light and Dark Mode CSS
|
50 |
custom_css = """
|
51 |
body {
|
52 |
font-family: 'Poppins', sans-serif;
|
|
|
53 |
margin: 0;
|
54 |
padding: 0;
|
55 |
+
transition: background-color 0.3s, color 0.3s;
|
56 |
}
|
57 |
+
.light-mode {
|
58 |
+
background-color: #f8f9fa;
|
59 |
+
color: #333;
|
60 |
}
|
61 |
+
.dark-mode {
|
62 |
+
background-color: #333;
|
63 |
+
color: #f8f9fa;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
|
|
65 |
button {
|
66 |
font-size: 1.2rem;
|
67 |
padding: 10px 20px;
|
|
|
|
|
|
|
68 |
border-radius: 5px;
|
69 |
cursor: pointer;
|
70 |
transition: 0.3s all;
|
|
|
71 |
}
|
72 |
+
button.light-mode {
|
73 |
+
background-color: #007bff;
|
74 |
+
color: #fff;
|
|
|
|
|
75 |
}
|
76 |
+
button.dark-mode {
|
77 |
+
background-color: #444;
|
78 |
+
color: #fff;
|
|
|
|
|
|
|
79 |
}
|
80 |
+
textarea {
|
|
|
|
|
|
|
|
|
|
|
81 |
padding: 10px;
|
|
|
82 |
border-radius: 8px;
|
83 |
transition: 0.3s;
|
84 |
}
|
85 |
+
textarea.light-mode {
|
86 |
+
background-color: #fff;
|
87 |
+
color: #333;
|
88 |
+
border: 2px solid #ccc;
|
89 |
+
}
|
90 |
+
textarea.dark-mode {
|
91 |
+
background-color: #444;
|
92 |
+
color: #f8f9fa;
|
93 |
+
border: 2px solid #555;
|
94 |
}
|
|
|
95 |
.output-image {
|
96 |
max-width: 100%;
|
97 |
border-radius: 12px;
|
98 |
border: 2px solid #007bff;
|
99 |
+
margin-top: 20px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
}
|
101 |
"""
|
102 |
|
103 |
+
# JavaScript to Toggle Modes
|
104 |
custom_js = """
|
105 |
<script>
|
106 |
document.addEventListener('DOMContentLoaded', function () {
|
107 |
+
const toggleButton = document.createElement('button');
|
108 |
+
toggleButton.textContent = 'Toggle Light/Dark Mode';
|
109 |
+
toggleButton.style.marginBottom = '20px';
|
110 |
+
toggleButton.onclick = () => {
|
111 |
+
document.body.classList.toggle('dark-mode');
|
112 |
+
document.body.classList.toggle('light-mode');
|
113 |
+
};
|
114 |
+
document.body.prepend(toggleButton);
|
115 |
+
document.body.classList.add('light-mode'); // Default to light mode
|
116 |
});
|
117 |
</script>
|
118 |
"""
|