CXM06 commited on
Commit
8aa7c2d
·
1 Parent(s): a3a0730

UI changes

Browse files
Files changed (1) hide show
  1. app.py +61 -10
app.py CHANGED
@@ -261,16 +261,17 @@ class CaptionGeneratorApp:
261
  elem_classes="image-upload"
262
  )
263
 
264
- gr.HTML('<div class="section-header"><span class="emoji-icon">🎨</span> Choose Style</div>')
265
-
266
- style_dropdown = gr.Dropdown(
267
- choices=self.style_model.get_available_styles(),
268
- value="Professional",
269
- label="",
270
- info="Select how you want your caption to be styled",
271
- elem_classes="style-dropdown",
272
- allow_custom_value=False
273
- )
 
274
 
275
  generate_btn = gr.Button(
276
  "✨ Generate Captions",
@@ -441,6 +442,7 @@ class CaptionGeneratorApp:
441
  border-radius: 12px;
442
  transition: all 0.3s ease;
443
  background: rgba(15, 23, 42, 0.5);
 
444
  }
445
 
446
  .image-upload:hover {
@@ -452,6 +454,15 @@ class CaptionGeneratorApp:
452
  /* Style dropdown */
453
  .style-dropdown {
454
  margin-bottom: 1rem;
 
 
 
 
 
 
 
 
 
455
  }
456
 
457
  /* Generate button - vibrant gradient */
@@ -702,6 +713,8 @@ class CaptionGeneratorApp:
702
  .gr-dropdown-menu {
703
  background: #1e293b !important;
704
  border: 1px solid rgba(139, 92, 246, 0.3) !important;
 
 
705
  }
706
 
707
  .gr-dropdown-menu option {
@@ -713,6 +726,44 @@ class CaptionGeneratorApp:
713
  background: rgba(139, 92, 246, 0.2) !important;
714
  }
715
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
716
  /* Image component styling */
717
  .gr-image {
718
  background: rgba(15, 23, 42, 0.5) !important;
 
261
  elem_classes="image-upload"
262
  )
263
 
264
+ with gr.Group(elem_classes="style-section"):
265
+ gr.HTML('<div class="section-header"><span class="emoji-icon">🎨</span> Choose Style</div>')
266
+
267
+ style_dropdown = gr.Dropdown(
268
+ choices=self.style_model.get_available_styles(),
269
+ value="Professional",
270
+ label="",
271
+ info="Select how you want your caption to be styled",
272
+ elem_classes="style-dropdown",
273
+ allow_custom_value=False
274
+ )
275
 
276
  generate_btn = gr.Button(
277
  "✨ Generate Captions",
 
442
  border-radius: 12px;
443
  transition: all 0.3s ease;
444
  background: rgba(15, 23, 42, 0.5);
445
+ margin-bottom: 1.5rem !important;
446
  }
447
 
448
  .image-upload:hover {
 
454
  /* Style dropdown */
455
  .style-dropdown {
456
  margin-bottom: 1rem;
457
+ position: relative !important;
458
+ width: 100% !important;
459
+ }
460
+
461
+ /* Ensure dropdown wrapper is properly positioned */
462
+ .style-dropdown .wrap,
463
+ .style-dropdown .wrap-inner {
464
+ position: relative !important;
465
+ width: 100% !important;
466
  }
467
 
468
  /* Generate button - vibrant gradient */
 
713
  .gr-dropdown-menu {
714
  background: #1e293b !important;
715
  border: 1px solid rgba(139, 92, 246, 0.3) !important;
716
+ position: absolute !important;
717
+ z-index: 1000 !important;
718
  }
719
 
720
  .gr-dropdown-menu option {
 
726
  background: rgba(139, 92, 246, 0.2) !important;
727
  }
728
 
729
+ /* Fix dropdown positioning on HF Spaces */
730
+ .input-column .gr-dropdown {
731
+ position: relative !important;
732
+ margin-top: 0.5rem !important;
733
+ margin-bottom: 1rem !important;
734
+ }
735
+
736
+ /* Style section container */
737
+ .style-section {
738
+ position: relative !important;
739
+ margin-top: 2rem !important;
740
+ width: 100% !important;
741
+ display: block !important;
742
+ }
743
+
744
+ /* Ensure proper spacing between image and style section */
745
+ .input-column .gr-image,
746
+ .input-column .image-upload {
747
+ margin-bottom: 2rem !important;
748
+ }
749
+
750
+ /* Target image container directly */
751
+ .input-column > div:has(.image-upload),
752
+ .input-column > div:has(.gr-image) {
753
+ margin-bottom: 2rem !important;
754
+ }
755
+
756
+ /* Fix for Gradio's dropdown container */
757
+ .input-column .gr-form {
758
+ position: relative !important;
759
+ }
760
+
761
+ /* Additional fix for HF Spaces - ensure dropdown stays in flow */
762
+ .input-column .gr-group {
763
+ position: relative !important;
764
+ display: block !important;
765
+ }
766
+
767
  /* Image component styling */
768
  .gr-image {
769
  background: rgba(15, 23, 42, 0.5) !important;