observantdistressed commited on
Commit
ac2d590
·
verified ·
1 Parent(s): 452f0d5

UI: glass v5 — body::before/::after for glow, JS glassApply force-styling labels/button/panels, CSS-only fallback, setInterval reapply

Browse files
Files changed (1) hide show
  1. app.py +83 -204
app.py CHANGED
@@ -676,26 +676,30 @@ GLASS_CSS = """
676
  overflow: hidden; position: absolute; pointer-events: none;
677
  }
678
 
679
- /* ── AMBIENT GLOW BLOBS — direct children of body, z-index behind everything ── */
680
- #glow-teal, #glow-purple {
 
681
  position: fixed !important;
682
  border-radius: 50% !important;
683
  filter: blur(140px) !important;
684
  pointer-events: none !important;
685
  z-index: 0 !important;
686
  }
687
- #glow-teal {
688
  width: 600px !important; height: 600px !important;
689
  left: -200px !important; top: 20% !important;
690
- background: rgba(0, 201, 167, 0.22) !important;
691
  }
692
- #glow-purple {
693
  width: 700px !important; height: 700px !important;
694
  right: -250px !important; top: 5% !important;
695
- background: rgba(168, 85, 247, 0.18) !important;
696
  }
697
 
698
  /* ── BACKGROUND — dark navy ── */
 
 
 
699
  .gradio-container {
700
  background: #0a0e1a !important;
701
  min-height: 100vh !important;
@@ -703,34 +707,7 @@ GLASS_CSS = """
703
  z-index: 1 !important;
704
  }
705
 
706
- /* ── GLASS PANELS — NO backdrop-filter (breaks dropdowns) ── */
707
- .glass-panel {
708
- background: rgba(15, 20, 35, 0.65) !important;
709
- border: 1px solid rgba(255, 255, 255, 0.10) !important;
710
- border-radius: 16px !important;
711
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35) !important;
712
- padding: 24px !important;
713
- }
714
- #input-panel {
715
- background: rgba(15, 20, 35, 0.60) !important;
716
- border: 1px solid rgba(255, 255, 255, 0.10) !important;
717
- border-radius: 16px !important;
718
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35) !important;
719
- padding: 28px !important;
720
- }
721
-
722
- /* ── SECTION LABELS — uppercase teal ── */
723
- .glass-label {
724
- font-size: 11px !important;
725
- font-weight: 700 !important;
726
- text-transform: uppercase !important;
727
- letter-spacing: 1.5px !important;
728
- color: #5eead4 !important;
729
- margin-bottom: 8px !important;
730
- display: block !important;
731
- }
732
-
733
- /* ── TITLE / SUBTITLE — float freely on background ── */
734
  .glass-title {
735
  font-size: 28px !important;
736
  font-weight: 700 !important;
@@ -745,176 +722,88 @@ GLASS_CSS = """
745
  line-height: 1.5 !important;
746
  }
747
 
748
- /* ── ALL Gradio labels — uppercase teal ── */
749
- .gradio-container label,
750
- .gradio-container .block .label-wrap span,
751
- .gradio-container [data-testid="checkbox-label"],
752
- .gradio-container [data-testid="slider-label"],
753
- .gradio-container [data-testid="dropdown-label"] {
754
  font-size: 11px !important;
755
  font-weight: 700 !important;
756
  text-transform: uppercase !important;
757
- letter-spacing: 1px !important;
758
- color: rgba(94, 234, 212, 0.85) !important;
759
- margin-bottom: 6px !important;
760
- }
761
- /* Override Gradio's scoped label color inside accordion/details/details */
762
- .gradio-container details summary span,
763
- .gradio-container .accordion > div > button > span,
764
- .gradio-container .label-wrap span,
765
- .gradio-container .block .label-wrap > span {
766
- color: rgba(94, 234, 212, 0.85) !important;
767
- }
768
- .gradio-container .prose small,
769
- .gradio-container small,
770
- .gradio-container .prose p {
771
- color: rgba(255, 255, 255, 0.35) !important;
772
- font-size: 12px !important;
773
- }
774
-
775
- /* ── TEXTAREA — dark transparent ── */
776
- textarea {
777
- background: rgba(0, 0, 0, 0.30) !important;
778
- border: 1px solid rgba(255, 255, 255, 0.10) !important;
779
- border-radius: 10px !important;
780
- color: #e2e8f0 !important;
781
- font-size: 15px !important;
782
- padding: 16px !important;
783
- }
784
- textarea:focus {
785
- border-color: rgba(94, 234, 212, 0.4) !important;
786
- box-shadow: 0 0 0 2px rgba(94, 234, 212, 0.1) !important;
787
- outline: none !important;
788
- }
789
-
790
- /* ── NUMBER INPUTS — dark glass ── */
791
- input[type="number"],
792
- input[data-testid="number-input"] {
793
- background: rgba(0, 0, 0, 0.30) !important;
794
- border: 1px solid rgba(255, 255, 255, 0.10) !important;
795
- border-radius: 8px !important;
796
- color: #e2e8f0 !important;
797
- }
798
-
799
- /* ── GENERATE BUTTON — gradient, override Gradio 6 CSS vars ── */
800
- :root {
801
- --button-primary-background-fill: linear-gradient(135deg, #00b894, #0984e3, #6c5ce7) !important;
802
- --button-primary-background-fill-hover: linear-gradient(135deg, #00a884, #0874d3, #5c4cd7) !important;
803
- }
804
- button.primary,
805
- button[data-testid="primary"],
806
- .gradio-container button.primary {
807
- background: linear-gradient(135deg, #00b894, #0984e3, #6c5ce7) !important;
808
- background-size: 200% 200% !important;
809
- animation: glass-shimmer 4s ease-in-out infinite !important;
810
- color: #ffffff !important;
811
- font-weight: 700 !important;
812
- font-size: 16px !important;
813
- border: none !important;
814
- border-radius: 12px !important;
815
- padding: 14px 32px !important;
816
- width: 100% !important;
817
- box-shadow: 0 4px 20px rgba(0, 184, 148, 0.35), 0 0 40px rgba(108, 92, 231, 0.15) !important;
818
- transition: transform 0.25s ease, box-shadow 0.3s ease !important;
819
- cursor: pointer !important;
820
- }
821
- button.primary:hover,
822
- button[data-testid="primary"]:hover {
823
- transform: translateY(-2px) !important;
824
- box-shadow: 0 8px 32px rgba(0, 184, 148, 0.5), 0 0 60px rgba(108, 92, 231, 0.25) !important;
825
- }
826
- @keyframes glass-shimmer {
827
- 0%, 100% { background-position: 0% 50%; }
828
- 50% { background-position: 100% 50%; }
829
- }
830
-
831
- /* ── CHECKBOXES — teal ── */
832
- input[type="checkbox"] {
833
- accent-color: #5eead4 !important;
834
- }
835
-
836
- /* ── SECONDARY BUTTON — glass ── */
837
- button.secondary {
838
- background: rgba(255, 255, 255, 0.06) !important;
839
- border: 1px solid rgba(255, 255, 255, 0.10) !important;
840
- color: rgba(255, 255, 255, 0.75) !important;
841
- border-radius: 10px !important;
842
- }
843
- button.secondary:hover {
844
- background: rgba(94, 234, 212, 0.10) !important;
845
- border-color: rgba(94, 234, 212, 0.3) !important;
846
- color: #5eead4 !important;
847
- }
848
-
849
- /* ── ACCORDION — glass header, teal ── */
850
- .gradio-container .label-wrap,
851
- .gradio-container details summary,
852
- .gradio-container [data-testid="accordion"] > div:first-child {
853
- background: rgba(255, 255, 255, 0.04) !important;
854
- border: 1px solid rgba(255, 255, 255, 0.08) !important;
855
- border-radius: 12px !important;
856
- color: #5eead4 !important;
857
- font-weight: 600 !important;
858
- text-transform: uppercase !important;
859
- letter-spacing: 1px !important;
860
- font-size: 12px !important;
861
- }
862
- .gradio-container .label-wrap:hover,
863
- .gradio-container details summary:hover {
864
  color: #5eead4 !important;
865
- background: rgba(94, 234, 212, 0.06) !important;
866
- }
867
-
868
- /* ── IMAGE UPLOAD — dashed glass ── */
869
- [data-testid="image"] {
870
- border: 2px dashed rgba(255, 255, 255, 0.12) !important;
871
- border-radius: 12px !important;
872
- background: rgba(0, 0, 0, 0.15) !important;
873
- }
874
-
875
- /* ── VIDEO / FILE OUTPUT — glass ── */
876
- [data-testid="video"],
877
- [data-testid="file"] {
878
- background: rgba(10, 14, 30, 0.5) !important;
879
- border: 1px solid rgba(255, 255, 255, 0.08) !important;
880
- border-radius: 12px !important;
881
  }
882
 
883
  /* ── LORA PREVIEW ── */
884
- #auto-lora-preview {
885
- color: rgba(255, 255, 255, 0.5) !important;
886
- }
887
- #auto-lora-preview b {
888
- color: #5eead4 !important;
889
- }
890
 
891
- /* ── GLASS CONTAINER for input column ── */
892
- #input-panel {
893
- background: rgba(15, 20, 35, 0.60) !important;
894
- border: 1px solid rgba(255, 255, 255, 0.10) !important;
895
- border-radius: 16px !important;
896
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35) !important;
897
- padding: 28px !important;
898
- }
899
 
900
- /* ── STATUS TEXT under video ── */
901
- .glass-status {
902
- color: rgba(255, 255, 255, 0.40) !important;
903
- font-size: 13px !important;
904
- text-align: center !important;
905
- margin-top: 12px !important;
906
- }
907
- .glass-status strong {
908
- color: rgba(255, 255, 255, 0.70) !important;
909
- }
910
 
911
- /* ── HIDE Gradio defaults we don't need ── */
912
- .gradio-container .prose {
913
- background: transparent !important;
914
- }
915
- .gradio-container footer {
916
- display: none !important;
917
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
918
  """
919
 
920
 
@@ -1059,16 +948,6 @@ if __name__ == "__main__":
1059
  checkbox_border_color_selected="#5eead4",
1060
  checkbox_border_color_focus="#5eead4",
1061
  )
1062
- GLASS_JS = """
1063
- <script>
1064
- (function(){
1065
- /* Glow blobs — injected into document.body so they escape Gradio's DOM stacking */
1066
- var t=document.createElement('div'); t.id='glow-teal';
1067
- var p=document.createElement('div'); p.id='glow-purple';
1068
- document.body.prepend(p); document.body.prepend(t);
1069
- })();
1070
- </script>
1071
- """
1072
  demo.queue().launch(
1073
  mcp_server=True,
1074
  head=f"<style>{GLASS_CSS}</style>{GLASS_JS}",
 
676
  overflow: hidden; position: absolute; pointer-events: none;
677
  }
678
 
679
+ /* ── AMBIENT GLOW — CSS-only via body pseudo-elements ── */
680
+ body::before, body::after {
681
+ content: '';
682
  position: fixed !important;
683
  border-radius: 50% !important;
684
  filter: blur(140px) !important;
685
  pointer-events: none !important;
686
  z-index: 0 !important;
687
  }
688
+ body::before {
689
  width: 600px !important; height: 600px !important;
690
  left: -200px !important; top: 20% !important;
691
+ background: rgba(0, 201, 167, 0.25) !important;
692
  }
693
+ body::after {
694
  width: 700px !important; height: 700px !important;
695
  right: -250px !important; top: 5% !important;
696
+ background: rgba(168, 85, 247, 0.20) !important;
697
  }
698
 
699
  /* ── BACKGROUND — dark navy ── */
700
+ body {
701
+ background: #0a0e1a !important;
702
+ }
703
  .gradio-container {
704
  background: #0a0e1a !important;
705
  min-height: 100vh !important;
 
707
  z-index: 1 !important;
708
  }
709
 
710
+ /* ── TITLE / SUBTITLE ── */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
711
  .glass-title {
712
  font-size: 28px !important;
713
  font-weight: 700 !important;
 
722
  line-height: 1.5 !important;
723
  }
724
 
725
+ /* ── SECTION LABELS (gr.HTML injected) ── */
726
+ .glass-label {
 
 
 
 
727
  font-size: 11px !important;
728
  font-weight: 700 !important;
729
  text-transform: uppercase !important;
730
+ letter-spacing: 1.5px !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
731
  color: #5eead4 !important;
732
+ margin-bottom: 8px !important;
733
+ display: block !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
734
  }
735
 
736
  /* ── LORA PREVIEW ── */
737
+ #auto-lora-preview { color: rgba(255,255,255,0.5) !important; }
738
+ #auto-lora-preview b { color: #5eead4 !important; }
 
 
 
 
739
 
740
+ /* ── STATUS TEXT ── */
741
+ .glass-status { color: rgba(255,255,255,0.40) !important; font-size: 13px !important; text-align: center !important; margin-top: 12px !important; }
742
+ .glass-status strong { color: rgba(255,255,255,0.70) !important; }
 
 
 
 
 
743
 
744
+ /* ── HIDE footer ── */
745
+ .gradio-container footer { display: none !important; }
746
+ """
 
 
 
 
 
 
 
747
 
748
+ GLASS_JS = """
749
+ <script>
750
+ (function(){
751
+ /* ═══ 1. GLOW BLOBS — injected into body, outside Gradio DOM ═══ */
752
+ var t=document.createElement('div'); t.id='glow-teal';
753
+ var p=document.createElement('div'); p.id='glow-purple';
754
+ document.body.prepend(p); document.body.prepend(t);
755
+
756
+ /* ═══ 2. FORCE-STYLE: labels, button, panels, accordion ═══ */
757
+ function glassApply(){
758
+ var teal='rgba(94,234,212,0.85)';
759
+ var tealDark='rgba(94,234,212,0.95)';
760
+
761
+ /* All visible labels → uppercase teal */
762
+ document.querySelectorAll('.gradio-container label').forEach(function(el){
763
+ el.style.cssText+='text-transform:uppercase!important;font-size:11px!important;font-weight:700!important;letter-spacing:1px!important;color:'+teal+'!important;margin-bottom:6px!important';
764
+ });
765
+
766
+ /* Slider labels specifically */
767
+ document.querySelectorAll('.gradio-container [data-testid="slider"] label').forEach(function(el){
768
+ el.style.cssText+='color:'+tealDark+'!important';
769
+ });
770
+
771
+ /* Dropdown labels */
772
+ document.querySelectorAll('.gradio-container [data-testid="dropdown"] label').forEach(function(el){
773
+ el.style.cssText+='color:'+tealDark+'!important';
774
+ });
775
+
776
+ /* Checkbox labels */
777
+ document.querySelectorAll('.gradio-container [data-testid="checkbox"] label').forEach(function(el){
778
+ el.style.cssText+='color:'+tealDark+'!important';
779
+ });
780
+
781
+ /* Accordion summary */
782
+ document.querySelectorAll('.gradio-container details summary').forEach(function(el){
783
+ el.style.cssText+='text-transform:uppercase!important;color:'+teal+'!important;font-weight:600!important;letter-spacing:1px!important;font-size:12px!important';
784
+ });
785
+
786
+ /* Generate button — gradient */
787
+ document.querySelectorAll('.gradio-container button.primary, .gradio-container button[data-variant="primary"]').forEach(function(el){
788
+ el.style.cssText+='background:linear-gradient(135deg,#00b894,#0984e3,#6c5ce7)!important;color:#fff!important;font-weight:700!important;font-size:16px!important;border:none!important;border-radius:12px!important;padding:14px 32px!important;width:100%!important;box-shadow:0 4px 20px rgba(0,184,148,0.35),0 0 40px rgba(108,92,231,0.15)!important;cursor:pointer!important';
789
+ });
790
+
791
+ /* Glass panels — semi-transparent */
792
+ document.querySelectorAll('#input-panel').forEach(function(el){
793
+ el.style.cssText+='background:rgba(15,20,35,0.55)!important;border:1px solid rgba(255,255,255,0.10)!important;border-radius:16px!important;box-shadow:0 8px 32px rgba(0,0,0,0.35)!important;padding:28px!important';
794
+ });
795
+ }
796
+
797
+ /* Run after Gradio renders, then watch for dynamic updates */
798
+ if(document.readyState==='loading'){
799
+ document.addEventListener('DOMContentLoaded',function(){setTimeout(glassApply,300);});
800
+ } else {
801
+ setTimeout(glassApply,300);
802
+ }
803
+ /* Reapply periodically for lazy-loaded elements (accordion expand, etc.) */
804
+ setInterval(glassApply,1500);
805
+ })();
806
+ </script>
807
  """
808
 
809
 
 
948
  checkbox_border_color_selected="#5eead4",
949
  checkbox_border_color_focus="#5eead4",
950
  )
 
 
 
 
 
 
 
 
 
 
951
  demo.queue().launch(
952
  mcp_server=True,
953
  head=f"<style>{GLASS_CSS}</style>{GLASS_JS}",