iimran commited on
Commit
9a3f2d8
·
verified ·
1 Parent(s): 1bad0ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +177 -5
app.py CHANGED
@@ -213,8 +213,180 @@ def build_ui() -> gr.Blocks:
213
  # Create transformer instance
214
  transformer = ImageTransformer()
215
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  # Gradio interface
217
- with gr.Blocks(css="custom_styles.css") as app:
218
  # Header
219
  gr.HTML(
220
  """
@@ -231,7 +403,7 @@ def build_ui() -> gr.Blocks:
231
  )
232
 
233
  # API key information
234
- with gr.Accordion("🔑 API Key Required", open=True, elem_classes="accordion-container"):
235
  gr.HTML(
236
  """
237
  <div class="accordion-content">
@@ -246,7 +418,7 @@ def build_ui() -> gr.Blocks:
246
  )
247
 
248
  # Usage instructions
249
- with gr.Accordion("📝 How To Use", open=False, elem_classes="accordion-container"):
250
  gr.HTML(
251
  """
252
  <div class="accordion-content">
@@ -292,7 +464,7 @@ def build_ui() -> gr.Blocks:
292
  label="Transformation Instructions"
293
  )
294
 
295
- transform_btn = gr.Button("Transform Image", elem_classes="generate-button")
296
 
297
  # Output column
298
  with gr.Column(elem_classes="output-column"):
@@ -335,7 +507,7 @@ def build_ui() -> gr.Blocks:
335
  # Footer
336
  gr.HTML(
337
  """
338
- <div class="app-footer">
339
  <p>ImageWizard © 2025 | Powered by Google Gemini and Gradio</p>
340
  </div>
341
  """
 
213
  # Create transformer instance
214
  transformer = ImageTransformer()
215
 
216
+ # Custom CSS
217
+ custom_css = """
218
+ /* Main theme colors */
219
+ :root {
220
+ --primary-color: #3a506b;
221
+ --secondary-color: #5bc0be;
222
+ --accent-color: #ffd166;
223
+ --background-color: #f8f9fa;
224
+ --text-color: #1c2541;
225
+ --border-radius: 8px;
226
+ --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
227
+ }
228
+
229
+ /* Global styles */
230
+ body {
231
+ font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
232
+ background-color: var(--background-color);
233
+ color: var(--text-color);
234
+ }
235
+
236
+ /* Header styling */
237
+ .app-header {
238
+ display: flex;
239
+ align-items: center;
240
+ gap: 20px;
241
+ padding: 16px 24px;
242
+ background: linear-gradient(135deg, var(--primary-color), #1c2541);
243
+ color: white;
244
+ border-radius: var(--border-radius);
245
+ margin-bottom: 24px;
246
+ box-shadow: var(--box-shadow);
247
+ }
248
+
249
+ .app-header img {
250
+ width: 48px;
251
+ height: 48px;
252
+ border-radius: 50%;
253
+ background-color: white;
254
+ padding: 6px;
255
+ }
256
+
257
+ .app-header h1 {
258
+ margin: 0;
259
+ font-size: 1.8rem;
260
+ font-weight: 700;
261
+ }
262
+
263
+ .app-header p {
264
+ margin: 4px 0 0 0;
265
+ opacity: 0.9;
266
+ font-size: 0.9rem;
267
+ }
268
+
269
+ .app-header a {
270
+ color: var(--accent-color);
271
+ text-decoration: none;
272
+ transition: opacity 0.2s;
273
+ }
274
+
275
+ .app-header a:hover {
276
+ opacity: 0.8;
277
+ text-decoration: underline;
278
+ }
279
+
280
+ /* Accordion styling */
281
+ .accordion-container {
282
+ margin-bottom: 20px;
283
+ border: 1px solid rgba(0, 0, 0, 0.1);
284
+ border-radius: var(--border-radius);
285
+ overflow: hidden;
286
+ }
287
+
288
+ .accordion-header {
289
+ background-color: var(--primary-color);
290
+ color: white;
291
+ padding: 12px 16px;
292
+ font-weight: 600;
293
+ }
294
+
295
+ .accordion-content {
296
+ padding: 16px;
297
+ background-color: white;
298
+ }
299
+
300
+ /* Main content area */
301
+ .main-container {
302
+ display: flex;
303
+ gap: 24px;
304
+ margin-bottom: 24px;
305
+ }
306
+
307
+ /* Input column */
308
+ .input-column {
309
+ flex: 1;
310
+ background-color: white;
311
+ padding: 20px;
312
+ border-radius: var(--border-radius);
313
+ box-shadow: var(--box-shadow);
314
+ }
315
+
316
+ /* Output column */
317
+ .output-column {
318
+ flex: 1;
319
+ background-color: white;
320
+ padding: 20px;
321
+ border-radius: var(--border-radius);
322
+ box-shadow: var(--box-shadow);
323
+ }
324
+
325
+ /* Button styling */
326
+ .generate-button {
327
+ background-color: var(--secondary-color) !important;
328
+ color: white !important;
329
+ border: none !important;
330
+ border-radius: var(--border-radius) !important;
331
+ padding: 12px 24px !important;
332
+ font-weight: 600 !important;
333
+ cursor: pointer !important;
334
+ transition: background-color 0.2s !important;
335
+ width: 100% !important;
336
+ margin-top: 16px !important;
337
+ }
338
+
339
+ .generate-button:hover {
340
+ background-color: #4ca8a6 !important;
341
+ }
342
+
343
+ /* Image upload area */
344
+ .image-upload {
345
+ border: 2px dashed rgba(0, 0, 0, 0.1);
346
+ border-radius: var(--border-radius);
347
+ padding: 20px;
348
+ text-align: center;
349
+ transition: border-color 0.2s;
350
+ }
351
+
352
+ .image-upload:hover {
353
+ border-color: var(--secondary-color);
354
+ }
355
+
356
+ /* Input fields */
357
+ input[type="text"], input[type="password"], textarea {
358
+ width: 100%;
359
+ padding: 10px 12px;
360
+ border: 1px solid rgba(0, 0, 0, 0.1);
361
+ border-radius: var(--border-radius);
362
+ margin-bottom: 16px;
363
+ font-family: inherit;
364
+ }
365
+
366
+ input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
367
+ border-color: var(--secondary-color);
368
+ outline: none;
369
+ }
370
+
371
+ /* Examples section */
372
+ .examples-header {
373
+ margin: 32px 0 16px 0;
374
+ font-weight: 600;
375
+ color: var(--primary-color);
376
+ }
377
+
378
+ /* Footer */
379
+ .app-footer {
380
+ text-align: center;
381
+ padding: 16px;
382
+ margin-top: 32px;
383
+ color: rgba(0, 0, 0, 0.5);
384
+ font-size: 0.8rem;
385
+ }
386
+ """
387
+
388
  # Gradio interface
389
+ with gr.Blocks(css=custom_css) as app:
390
  # Header
391
  gr.HTML(
392
  """
 
403
  )
404
 
405
  # API key information
406
+ with gr.Accordion("🔑 API Key Required", open=True):
407
  gr.HTML(
408
  """
409
  <div class="accordion-content">
 
418
  )
419
 
420
  # Usage instructions
421
+ with gr.Accordion("📝 How To Use", open=False):
422
  gr.HTML(
423
  """
424
  <div class="accordion-content">
 
464
  label="Transformation Instructions"
465
  )
466
 
467
+ transform_btn = gr.Button("Transform Image", variant="primary")
468
 
469
  # Output column
470
  with gr.Column(elem_classes="output-column"):
 
507
  # Footer
508
  gr.HTML(
509
  """
510
+ <div style="text-align: center; padding: 16px; margin-top: 32px; color: rgba(0, 0, 0, 0.5); font-size: 0.8rem;">
511
  <p>ImageWizard © 2025 | Powered by Google Gemini and Gradio</p>
512
  </div>
513
  """