Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -130,104 +130,121 @@ def process_images(prompt, image1, image2=None):
|
|
130 |
# Enhanced CSS with modern, minimal design
|
131 |
css = """
|
132 |
.gradio-container {
|
133 |
-
background: linear-gradient(
|
134 |
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
135 |
min-height: 100vh;
|
136 |
}
|
137 |
.header-container {
|
138 |
background: linear-gradient(135deg, #ffd93d 0%, #ffb347 100%);
|
139 |
-
padding:
|
140 |
-
border-radius:
|
141 |
-
margin-bottom:
|
142 |
-
box-shadow: 0 20px
|
143 |
}
|
144 |
.logo-text {
|
145 |
font-size: 3.5rem;
|
146 |
font-weight: 900;
|
147 |
-
color: #
|
148 |
text-align: center;
|
149 |
margin: 0;
|
150 |
letter-spacing: -2px;
|
151 |
}
|
152 |
.subtitle {
|
153 |
-
color: #
|
154 |
text-align: center;
|
155 |
font-size: 1rem;
|
156 |
margin-top: 0.5rem;
|
157 |
-
opacity: 0.
|
158 |
}
|
159 |
.main-content {
|
160 |
-
background: rgba(255, 255, 255, 0.
|
161 |
-
backdrop-filter: blur(
|
162 |
-
border-radius:
|
163 |
-
padding:
|
164 |
-
|
165 |
}
|
166 |
.gr-button-primary {
|
167 |
background: linear-gradient(135deg, #ffd93d 0%, #ffb347 100%) !important;
|
168 |
border: none !important;
|
169 |
-
color: #
|
170 |
font-weight: 700 !important;
|
171 |
font-size: 1.1rem !important;
|
172 |
-
padding:
|
173 |
-
border-radius:
|
174 |
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
175 |
text-transform: uppercase;
|
176 |
letter-spacing: 1px;
|
|
|
|
|
177 |
}
|
178 |
.gr-button-primary:hover {
|
179 |
-
transform: translateY(-
|
180 |
-
box-shadow: 0
|
181 |
}
|
182 |
.gr-input, .gr-textarea {
|
183 |
-
background:
|
184 |
-
border:
|
185 |
-
border-radius:
|
186 |
-
color:
|
187 |
font-size: 1rem !important;
|
|
|
188 |
}
|
189 |
.gr-input:focus, .gr-textarea:focus {
|
190 |
border-color: #ffd93d !important;
|
191 |
-
box-shadow: 0 0 0
|
192 |
}
|
193 |
.gr-form {
|
194 |
background: transparent !important;
|
195 |
border: none !important;
|
196 |
}
|
197 |
.gr-panel {
|
198 |
-
background:
|
199 |
-
border:
|
200 |
border-radius: 16px !important;
|
201 |
padding: 1.5rem !important;
|
202 |
}
|
203 |
.gr-box {
|
204 |
-
border-radius:
|
205 |
-
border-color:
|
206 |
}
|
207 |
label {
|
208 |
-
color:
|
209 |
font-weight: 600 !important;
|
210 |
-
font-size: 0.
|
211 |
text-transform: uppercase;
|
212 |
-
letter-spacing:
|
213 |
margin-bottom: 0.5rem !important;
|
214 |
}
|
215 |
.status-text {
|
216 |
font-family: 'SF Mono', 'Monaco', monospace;
|
217 |
-
color: #
|
218 |
-
|
219 |
-
background: rgba(255, 217, 61, 0.1);
|
220 |
-
border-radius: 8px;
|
221 |
-
border: 1px solid rgba(255, 217, 61, 0.3);
|
222 |
}
|
223 |
.image-container {
|
224 |
-
border-radius:
|
225 |
overflow: hidden;
|
226 |
-
|
|
|
227 |
}
|
228 |
footer {
|
229 |
display: none !important;
|
230 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
"""
|
232 |
|
233 |
# Build the interface
|
@@ -239,48 +256,52 @@ with gr.Blocks(css=css, theme=gr.themes.Base()) as demo:
|
|
239 |
""")
|
240 |
|
241 |
with gr.Column(elem_classes="main-content"):
|
242 |
-
with gr.Row():
|
|
|
243 |
with gr.Column(scale=1):
|
244 |
prompt = gr.Textbox(
|
245 |
-
label="
|
246 |
placeholder="Describe your style...",
|
247 |
-
lines=
|
248 |
-
value="Make the sheets in the style of the logo. Make the scene natural."
|
|
|
249 |
)
|
250 |
|
251 |
-
with gr.Row():
|
252 |
image1 = gr.Image(
|
253 |
-
label="Image
|
254 |
type="pil",
|
255 |
-
height=
|
256 |
-
elem_classes="image-container"
|
257 |
)
|
258 |
image2 = gr.Image(
|
259 |
-
label="Image
|
260 |
type="pil",
|
261 |
-
height=
|
262 |
-
elem_classes="image-container"
|
263 |
)
|
264 |
|
265 |
generate_btn = gr.Button(
|
266 |
-
"Generate",
|
267 |
variant="primary",
|
268 |
size="lg"
|
269 |
)
|
270 |
|
|
|
271 |
with gr.Column(scale=1):
|
272 |
output_image = gr.Image(
|
273 |
-
label="Result",
|
274 |
type="pil",
|
275 |
-
height=
|
276 |
-
elem_classes="image-container"
|
277 |
)
|
278 |
|
279 |
status = gr.Textbox(
|
280 |
label="Status",
|
281 |
interactive=False,
|
282 |
lines=1,
|
283 |
-
elem_classes="status-text"
|
|
|
284 |
)
|
285 |
|
286 |
# Event handler
|
|
|
130 |
# Enhanced CSS with modern, minimal design
|
131 |
css = """
|
132 |
.gradio-container {
|
133 |
+
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
134 |
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
135 |
min-height: 100vh;
|
136 |
}
|
137 |
.header-container {
|
138 |
background: linear-gradient(135deg, #ffd93d 0%, #ffb347 100%);
|
139 |
+
padding: 2.5rem;
|
140 |
+
border-radius: 24px;
|
141 |
+
margin-bottom: 2.5rem;
|
142 |
+
box-shadow: 0 20px 60px rgba(255, 179, 71, 0.25);
|
143 |
}
|
144 |
.logo-text {
|
145 |
font-size: 3.5rem;
|
146 |
font-weight: 900;
|
147 |
+
color: #2d3436;
|
148 |
text-align: center;
|
149 |
margin: 0;
|
150 |
letter-spacing: -2px;
|
151 |
}
|
152 |
.subtitle {
|
153 |
+
color: #2d3436;
|
154 |
text-align: center;
|
155 |
font-size: 1rem;
|
156 |
margin-top: 0.5rem;
|
157 |
+
opacity: 0.8;
|
158 |
}
|
159 |
.main-content {
|
160 |
+
background: rgba(255, 255, 255, 0.95);
|
161 |
+
backdrop-filter: blur(20px);
|
162 |
+
border-radius: 24px;
|
163 |
+
padding: 2.5rem;
|
164 |
+
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
|
165 |
}
|
166 |
.gr-button-primary {
|
167 |
background: linear-gradient(135deg, #ffd93d 0%, #ffb347 100%) !important;
|
168 |
border: none !important;
|
169 |
+
color: #2d3436 !important;
|
170 |
font-weight: 700 !important;
|
171 |
font-size: 1.1rem !important;
|
172 |
+
padding: 1.2rem 2rem !important;
|
173 |
+
border-radius: 14px !important;
|
174 |
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
175 |
text-transform: uppercase;
|
176 |
letter-spacing: 1px;
|
177 |
+
width: 100%;
|
178 |
+
margin-top: 1rem !important;
|
179 |
}
|
180 |
.gr-button-primary:hover {
|
181 |
+
transform: translateY(-3px) !important;
|
182 |
+
box-shadow: 0 15px 40px rgba(255, 179, 71, 0.35) !important;
|
183 |
}
|
184 |
.gr-input, .gr-textarea {
|
185 |
+
background: #ffffff !important;
|
186 |
+
border: 2px solid #e1e8ed !important;
|
187 |
+
border-radius: 14px !important;
|
188 |
+
color: #2d3436 !important;
|
189 |
font-size: 1rem !important;
|
190 |
+
padding: 0.8rem 1rem !important;
|
191 |
}
|
192 |
.gr-input:focus, .gr-textarea:focus {
|
193 |
border-color: #ffd93d !important;
|
194 |
+
box-shadow: 0 0 0 4px rgba(255, 217, 61, 0.15) !important;
|
195 |
}
|
196 |
.gr-form {
|
197 |
background: transparent !important;
|
198 |
border: none !important;
|
199 |
}
|
200 |
.gr-panel {
|
201 |
+
background: #ffffff !important;
|
202 |
+
border: 2px solid #e1e8ed !important;
|
203 |
border-radius: 16px !important;
|
204 |
padding: 1.5rem !important;
|
205 |
}
|
206 |
.gr-box {
|
207 |
+
border-radius: 14px !important;
|
208 |
+
border-color: #e1e8ed !important;
|
209 |
}
|
210 |
label {
|
211 |
+
color: #636e72 !important;
|
212 |
font-weight: 600 !important;
|
213 |
+
font-size: 0.85rem !important;
|
214 |
text-transform: uppercase;
|
215 |
+
letter-spacing: 0.5px;
|
216 |
margin-bottom: 0.5rem !important;
|
217 |
}
|
218 |
.status-text {
|
219 |
font-family: 'SF Mono', 'Monaco', monospace;
|
220 |
+
color: #00b894;
|
221 |
+
font-size: 0.9rem;
|
|
|
|
|
|
|
222 |
}
|
223 |
.image-container {
|
224 |
+
border-radius: 14px !important;
|
225 |
overflow: hidden;
|
226 |
+
border: 2px solid #e1e8ed !important;
|
227 |
+
background: #fafbfc !important;
|
228 |
}
|
229 |
footer {
|
230 |
display: none !important;
|
231 |
}
|
232 |
+
/* Equal sizing for all image containers */
|
233 |
+
.image-upload {
|
234 |
+
min-height: 200px !important;
|
235 |
+
max-height: 200px !important;
|
236 |
+
}
|
237 |
+
.output-image {
|
238 |
+
min-height: 420px !important;
|
239 |
+
max-height: 420px !important;
|
240 |
+
}
|
241 |
+
/* Ensure consistent spacing */
|
242 |
+
.gr-row {
|
243 |
+
gap: 1rem !important;
|
244 |
+
}
|
245 |
+
.gr-column {
|
246 |
+
gap: 1rem !important;
|
247 |
+
}
|
248 |
"""
|
249 |
|
250 |
# Build the interface
|
|
|
256 |
""")
|
257 |
|
258 |
with gr.Column(elem_classes="main-content"):
|
259 |
+
with gr.Row(equal_height=True):
|
260 |
+
# Left Column - Inputs
|
261 |
with gr.Column(scale=1):
|
262 |
prompt = gr.Textbox(
|
263 |
+
label="Style Description",
|
264 |
placeholder="Describe your style...",
|
265 |
+
lines=3,
|
266 |
+
value="Make the sheets in the style of the logo. Make the scene natural.",
|
267 |
+
elem_classes="prompt-input"
|
268 |
)
|
269 |
|
270 |
+
with gr.Row(equal_height=True):
|
271 |
image1 = gr.Image(
|
272 |
+
label="Primary Image",
|
273 |
type="pil",
|
274 |
+
height=200,
|
275 |
+
elem_classes="image-container image-upload"
|
276 |
)
|
277 |
image2 = gr.Image(
|
278 |
+
label="Secondary Image",
|
279 |
type="pil",
|
280 |
+
height=200,
|
281 |
+
elem_classes="image-container image-upload"
|
282 |
)
|
283 |
|
284 |
generate_btn = gr.Button(
|
285 |
+
"Generate Magic ✨",
|
286 |
variant="primary",
|
287 |
size="lg"
|
288 |
)
|
289 |
|
290 |
+
# Right Column - Output
|
291 |
with gr.Column(scale=1):
|
292 |
output_image = gr.Image(
|
293 |
+
label="Generated Result",
|
294 |
type="pil",
|
295 |
+
height=420,
|
296 |
+
elem_classes="image-container output-image"
|
297 |
)
|
298 |
|
299 |
status = gr.Textbox(
|
300 |
label="Status",
|
301 |
interactive=False,
|
302 |
lines=1,
|
303 |
+
elem_classes="status-text",
|
304 |
+
value="Ready to generate..."
|
305 |
)
|
306 |
|
307 |
# Event handler
|