observantdistressed commited on
Commit
27b09f6
·
verified ·
1 Parent(s): 15748f3

UI: fix slider via theme slider_color + move CSS to launch(head=) to bypass prefix_css rewriting

Browse files
Files changed (1) hide show
  1. app.py +7 -54
app.py CHANGED
@@ -872,59 +872,7 @@ CSS = """
872
  """
873
 
874
 
875
- THEME_JS = r"""
876
- (function() {
877
- function styleSlider() {
878
- var inp = document.querySelector('#duration-slider input[data-testid="range-input"]')
879
- || document.querySelector('#duration-slider input[type="range"]');
880
- if (!inp) return false;
881
- var id = 'slider-theme-styles';
882
- if (!document.getElementById(id)) {
883
- var s = document.createElement('style');
884
- s.id = id;
885
- s.textContent = [
886
- '#duration-slider input[type="range"]::-webkit-slider-thumb {',
887
- ' -webkit-appearance: none !important;',
888
- ' appearance: none !important;',
889
- ' width: 18px !important; height: 18px !important;',
890
- ' border-radius: 50% !important;',
891
- ' background: linear-gradient(135deg, #00e5c8, #6c5ce7) !important;',
892
- ' border: 2px solid rgba(255,255,255,0.3) !important;',
893
- ' box-shadow: 0 0 8px rgba(0,229,200,0.5) !important;',
894
- ' cursor: pointer !important; margin-top: -6px !important;',
895
- '}',
896
- '#duration-slider input[type="range"]::-webkit-slider-runnable-track {',
897
- ' background: linear-gradient(90deg, #00d4aa, #6c5ce7) !important;',
898
- ' height: 6px !important; border-radius: 3px !important;',
899
- '}',
900
- '#duration-slider input[type="range"]::-moz-range-thumb {',
901
- ' width: 18px !important; height: 18px !important;',
902
- ' border-radius: 50% !important;',
903
- ' background: linear-gradient(135deg, #00e5c8, #6c5ce7) !important;',
904
- ' border: 2px solid rgba(255,255,255,0.3) !important;',
905
- ' box-shadow: 0 0 8px rgba(0,229,200,0.5) !important;',
906
- ' cursor: pointer !important;',
907
- '}',
908
- '#duration-slider input[type="range"]::-moz-range-track {',
909
- ' background: linear-gradient(90deg, #00d4aa, #6c5ce7) !important;',
910
- ' height: 6px !important; border-radius: 3px !important;',
911
- '}',
912
- ].join('\n');
913
- document.head.appendChild(s);
914
- }
915
- return true;
916
- }
917
- if (!styleSlider()) {
918
- var obs = new MutationObserver(function() {
919
- if (styleSlider()) obs.disconnect();
920
- });
921
- obs.observe(document.body, {childList: true, subtree: true});
922
- setTimeout(function() { obs.disconnect(); }, 15000);
923
- }
924
- })();
925
- """
926
-
927
- with gr.Blocks(delete_cache=(3600, 10800), js=THEME_JS) as demo:
928
  gr.Markdown(model_title())
929
  gr.Markdown("Run Wan 2.2 in just 4-8 steps, fp8 quantization & AoT compilation - compatible with 🧨 diffusers and ZeroGPU")
930
 
@@ -1037,8 +985,13 @@ with gr.Blocks(delete_cache=(3600, 10800), js=THEME_JS) as demo:
1037
  )
1038
 
1039
  if __name__ == "__main__":
 
 
 
 
1040
  demo.queue().launch(
1041
  mcp_server=True,
1042
- css=CSS,
 
1043
  show_error=True,
1044
  )
 
872
  """
873
 
874
 
875
+ with gr.Blocks(delete_cache=(3600, 10800)) as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
876
  gr.Markdown(model_title())
877
  gr.Markdown("Run Wan 2.2 in just 4-8 steps, fp8 quantization & AoT compilation - compatible with 🧨 diffusers and ZeroGPU")
878
 
 
985
  )
986
 
987
  if __name__ == "__main__":
988
+ theme = gr.themes.Default().set(
989
+ slider_color="#00d4aa",
990
+ slider_color_dark="#00d4aa",
991
+ )
992
  demo.queue().launch(
993
  mcp_server=True,
994
+ head=f"<style>{CSS}</style>",
995
+ theme=theme,
996
  show_error=True,
997
  )