prithivMLmods commited on
Commit
21cbcbb
·
verified ·
1 Parent(s): 27db21f

update app

Browse files
Files changed (1) hide show
  1. app.py +80 -74
app.py CHANGED
@@ -13,27 +13,27 @@ from qwenimage.qwen_fa3_processor import QwenDoubleStreamAttnProcessorFA3
13
  from gradio.themes import Soft
14
  from gradio.themes.utils import colors, fonts, sizes
15
 
16
- colors.orange_red = colors.Color(
17
- name="orange_red",
18
- c50="#FFF5F0",
19
- c100="#FFE8E0",
20
- c200="#FFC299",
21
- c300="#FFA366",
22
- c400="#FF8533",
23
- c500="#FF4500",
24
- c600="#E63E00",
25
- c700="#CC3700",
26
- c800="#B33000",
27
- c900="#992900",
28
- c950="#802200",
29
  )
30
 
31
- class OrangeRedTheme(Soft):
32
  def __init__(
33
  self,
34
  *,
35
  primary_hue: colors.Color | str = colors.gray,
36
- secondary_hue: colors.Color | str = colors.orange_red,
37
  neutral_hue: colors.Color | str = colors.slate,
38
  text_size: sizes.Size | str = sizes.text_lg,
39
  font: fonts.Font | str | Iterable[fonts.Font | str] = (
@@ -79,7 +79,7 @@ class OrangeRedTheme(Soft):
79
  block_label_background_fill="*primary_200",
80
  )
81
 
82
- orange_red_theme = OrangeRedTheme()
83
 
84
  MAX_SEED = np.iinfo(np.int32).max
85
 
@@ -465,7 +465,7 @@ class LightingControl3D(gr.HTML):
465
  refreshBtn.style.position = 'absolute';
466
  refreshBtn.style.top = '15px';
467
  refreshBtn.style.right = '15px';
468
- refreshBtn.style.background = '#e63e00';
469
  refreshBtn.style.color = '#fff';
470
  refreshBtn.style.border = 'none';
471
  refreshBtn.style.padding = '8px 16px';
@@ -478,8 +478,8 @@ class LightingControl3D(gr.HTML):
478
  refreshBtn.style.boxShadow = '0 2px 5px rgba(0,0,0,0.3)';
479
  refreshBtn.style.transition = 'background 0.2s';
480
 
481
- refreshBtn.onmouseover = () => refreshBtn.style.background = '#ff5722';
482
- refreshBtn.onmouseout = () => refreshBtn.style.background = '#e63e00';
483
 
484
  wrapper.appendChild(refreshBtn);
485
 
@@ -743,12 +743,12 @@ class LightingControl3D(gr.HTML):
743
  css = """
744
  @import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');
745
 
746
- /* Background grid pattern - Orange Red theme */
747
  body, .gradio-container {
748
- background-color: #FFF5F0 !important;
749
  background-image:
750
- linear-gradient(#FFC299 1px, transparent 1px),
751
- linear-gradient(90deg, #FFC299 1px, transparent 1px) !important;
752
  background-size: 40px 40px !important;
753
  font-family: 'Outfit', sans-serif !important;
754
  }
@@ -757,8 +757,8 @@ body, .gradio-container {
757
  .dark body, .dark .gradio-container {
758
  background-color: #1a1a1a !important;
759
  background-image:
760
- linear-gradient(rgba(255, 69, 0, 0.1) 1px, transparent 1px),
761
- linear-gradient(90deg, rgba(255, 69, 0, 0.1) 1px, transparent 1px) !important;
762
  background-size: 40px 40px !important;
763
  }
764
 
@@ -776,7 +776,7 @@ body, .gradio-container {
776
  #main-title h1 {
777
  font-size: 2.4em !important;
778
  font-weight: 700 !important;
779
- background: linear-gradient(135deg, #FF4500 0%, #FF8533 50%, #E63E00 100%);
780
  background-size: 200% 200%;
781
  -webkit-background-clip: text;
782
  -webkit-text-fill-color: transparent;
@@ -800,10 +800,11 @@ body, .gradio-container {
800
  margin: 0 auto;
801
  color: #666666;
802
  font-size: 1rem;
 
803
  }
804
 
805
  #subtitle a {
806
- color: #FF4500 !important;
807
  text-decoration: none;
808
  font-weight: 500;
809
  }
@@ -812,37 +813,42 @@ body, .gradio-container {
812
  text-decoration: underline;
813
  }
814
 
 
 
 
 
 
815
  /* Card styling */
816
  .gradio-group {
817
  background: rgba(255, 255, 255, 0.9) !important;
818
- border: 2px solid #FFC299 !important;
819
  border-radius: 12px !important;
820
- box-shadow: 0 4px 24px rgba(255, 69, 0, 0.08) !important;
821
  backdrop-filter: blur(10px);
822
  transition: all 0.3s ease;
823
  }
824
 
825
  .gradio-group:hover {
826
- box-shadow: 0 8px 32px rgba(255, 69, 0, 0.12) !important;
827
- border-color: #FF8533 !important;
828
  }
829
 
830
  .dark .gradio-group {
831
  background: rgba(30, 30, 30, 0.9) !important;
832
- border-color: rgba(255, 69, 0, 0.3) !important;
833
  }
834
 
835
  /* Image upload area */
836
  .gradio-image {
837
  border-radius: 10px !important;
838
  overflow: hidden;
839
- border: 2px dashed #FF8533 !important;
840
  transition: all 0.3s ease;
841
  }
842
 
843
  .gradio-image:hover {
844
- border-color: #FF4500 !important;
845
- background: rgba(255, 69, 0, 0.02) !important;
846
  }
847
 
848
  /* Radio buttons */
@@ -857,12 +863,12 @@ body, .gradio-container {
857
  }
858
 
859
  .gradio-radio label:hover {
860
- background: rgba(255, 69, 0, 0.05) !important;
861
  }
862
 
863
  .gradio-radio label.selected {
864
- background: rgba(255, 69, 0, 0.1) !important;
865
- border-color: #FF4500 !important;
866
  }
867
 
868
  /* Primary button */
@@ -879,7 +885,7 @@ body, .gradio-container {
879
 
880
  /* Tabs styling */
881
  .tab-nav {
882
- border-bottom: 2px solid #FFC299 !important;
883
  }
884
 
885
  .tab-nav button {
@@ -890,8 +896,8 @@ body, .gradio-container {
890
  }
891
 
892
  .tab-nav button.selected {
893
- background: rgba(255, 69, 0, 0.1) !important;
894
- border-bottom: 2px solid #FF4500 !important;
895
  }
896
 
897
  /* Output textbox */
@@ -900,13 +906,13 @@ body, .gradio-container {
900
  font-size: 0.95rem !important;
901
  line-height: 1.7 !important;
902
  background: rgba(255, 255, 255, 0.95) !important;
903
- border: 1px solid #FFC299 !important;
904
  border-radius: 8px !important;
905
  }
906
 
907
  .dark .gradio-textbox textarea {
908
  background: rgba(30, 30, 30, 0.95) !important;
909
- border-color: rgba(255, 69, 0, 0.2) !important;
910
  }
911
 
912
  /* Markdown output */
@@ -917,15 +923,15 @@ body, .gradio-container {
917
 
918
  .gradio-markdown code {
919
  font-family: 'IBM Plex Mono', monospace !important;
920
- background: rgba(255, 69, 0, 0.08) !important;
921
  padding: 2px 6px !important;
922
  border-radius: 4px !important;
923
- color: #CC3700 !important;
924
  }
925
 
926
  .gradio-markdown pre {
927
- background: rgba(255, 69, 0, 0.05) !important;
928
- border: 1px solid #FFC299 !important;
929
  border-radius: 8px !important;
930
  padding: 1rem !important;
931
  }
@@ -936,15 +942,15 @@ body, .gradio-container {
936
  }
937
 
938
  .gradio-examples .gallery-item {
939
- border: 2px solid #FFC299 !important;
940
  border-radius: 8px !important;
941
  transition: all 0.2s ease !important;
942
  }
943
 
944
  .gradio-examples .gallery-item:hover {
945
- border-color: #FF4500 !important;
946
  transform: translateY(-2px) !important;
947
- box-shadow: 0 4px 12px rgba(255, 69, 0, 0.15) !important;
948
  }
949
 
950
  /* Scrollbar styling */
@@ -954,27 +960,27 @@ body, .gradio-container {
954
  }
955
 
956
  ::-webkit-scrollbar-track {
957
- background: rgba(255, 69, 0, 0.05);
958
  border-radius: 4px;
959
  }
960
 
961
  ::-webkit-scrollbar-thumb {
962
- background: linear-gradient(135deg, #FF4500, #FF8533);
963
  border-radius: 4px;
964
  }
965
 
966
  ::-webkit-scrollbar-thumb:hover {
967
- background: linear-gradient(135deg, #E63E00, #FF4500);
968
  }
969
 
970
  /* Accordion styling */
971
  .gradio-accordion {
972
  border-radius: 10px !important;
973
- border: 1px solid #FFC299 !important;
974
  }
975
 
976
  .gradio-accordion > .label-wrap {
977
- background: rgba(255, 69, 0, 0.03) !important;
978
  border-radius: 10px !important;
979
  }
980
 
@@ -1009,34 +1015,34 @@ label {
1009
  }
1010
 
1011
  .gradio-dropdown select, .gradio-dropdown input {
1012
- border: 1px solid #FFC299 !important;
1013
  border-radius: 8px !important;
1014
  transition: all 0.2s ease !important;
1015
  }
1016
 
1017
  .gradio-dropdown select:focus, .gradio-dropdown input:focus {
1018
- border-color: #FF4500 !important;
1019
- box-shadow: 0 0 0 2px rgba(255, 69, 0, 0.1) !important;
1020
  }
1021
 
1022
  /* Slider styling */
1023
  .gradio-slider input[type="range"] {
1024
- accent-color: #FF4500 !important;
1025
  }
1026
 
1027
  .gradio-slider .range-slider {
1028
- background: #FFC299 !important;
1029
  }
1030
 
1031
  .gradio-slider .range-slider .handle {
1032
- background: #FF4500 !important;
1033
- border-color: #FF4500 !important;
1034
  }
1035
 
1036
  /* 3D Control styling */
1037
  #lighting-3d-control {
1038
  min-height: 450px;
1039
- border: 2px solid #FFC299 !important;
1040
  border-radius: 12px !important;
1041
  overflow: hidden;
1042
  }
@@ -1047,24 +1053,24 @@ label {
1047
  }
1048
 
1049
  .progress-bar {
1050
- background: linear-gradient(90deg, #FF4500, #FF8533) !important;
1051
  }
1052
 
1053
  /* Checkbox styling */
1054
  .gradio-checkbox input[type="checkbox"]:checked {
1055
- background-color: #FF4500 !important;
1056
- border-color: #FF4500 !important;
1057
  }
1058
 
1059
  /* Number input styling */
1060
  .gradio-number input {
1061
- border: 1px solid #FFC299 !important;
1062
  border-radius: 8px !important;
1063
  }
1064
 
1065
  .gradio-number input:focus {
1066
- border-color: #FF4500 !important;
1067
- box-shadow: 0 0 0 2px rgba(255, 69, 0, 0.1) !important;
1068
  }
1069
 
1070
  /* Gallery styling */
@@ -1073,14 +1079,14 @@ label {
1073
  }
1074
 
1075
  .gradio-gallery .gallery-item {
1076
- border: 2px solid #FFC299 !important;
1077
  border-radius: 8px !important;
1078
  transition: all 0.2s ease !important;
1079
  }
1080
 
1081
  .gradio-gallery .gallery-item:hover {
1082
- border-color: #FF4500 !important;
1083
- box-shadow: 0 4px 12px rgba(255, 69, 0, 0.15) !important;
1084
  }
1085
 
1086
  /* Fillable container */
@@ -1091,7 +1097,7 @@ label {
1091
 
1092
  with gr.Blocks() as demo:
1093
  gr.Markdown("# **Qwen-Image-Edit-3D-Lighting-Control**", elem_id="main-title")
1094
- gr.Markdown("Control lighting directions using the 3D viewport or sliders. Using the [Multi-Angle-Lighting](https://huggingface.co/dx8152/Qwen-Edit-2509-Multi-Angle-Lighting) LoRA for precise lighting control.")
1095
 
1096
  with gr.Row():
1097
  with gr.Column(scale=1):
@@ -1223,4 +1229,4 @@ with gr.Blocks() as demo:
1223
 
1224
  if __name__ == "__main__":
1225
  head = '<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>'
1226
- demo.launch(head=head, css=css, theme=orange_red_theme, mcp_server=True, ssr_mode=False, show_error=True)
 
13
  from gradio.themes import Soft
14
  from gradio.themes.utils import colors, fonts, sizes
15
 
16
+ colors.purple = colors.Color(
17
+ name="purple",
18
+ c50="#FAF5FF",
19
+ c100="#F3E8FF",
20
+ c200="#E9D5FF",
21
+ c300="#DAB2FF",
22
+ c400="#C084FC",
23
+ c500="#A855F7",
24
+ c600="#9333EA",
25
+ c700="#7E22CE",
26
+ c800="#6B21A8",
27
+ c900="#581C87",
28
+ c950="#3B0764",
29
  )
30
 
31
+ class PurpleTheme(Soft):
32
  def __init__(
33
  self,
34
  *,
35
  primary_hue: colors.Color | str = colors.gray,
36
+ secondary_hue: colors.Color | str = colors.purple,
37
  neutral_hue: colors.Color | str = colors.slate,
38
  text_size: sizes.Size | str = sizes.text_lg,
39
  font: fonts.Font | str | Iterable[fonts.Font | str] = (
 
79
  block_label_background_fill="*primary_200",
80
  )
81
 
82
+ purple_theme = PurpleTheme()
83
 
84
  MAX_SEED = np.iinfo(np.int32).max
85
 
 
465
  refreshBtn.style.position = 'absolute';
466
  refreshBtn.style.top = '15px';
467
  refreshBtn.style.right = '15px';
468
+ refreshBtn.style.background = '#9333EA';
469
  refreshBtn.style.color = '#fff';
470
  refreshBtn.style.border = 'none';
471
  refreshBtn.style.padding = '8px 16px';
 
478
  refreshBtn.style.boxShadow = '0 2px 5px rgba(0,0,0,0.3)';
479
  refreshBtn.style.transition = 'background 0.2s';
480
 
481
+ refreshBtn.onmouseover = () => refreshBtn.style.background = '#A855F7';
482
+ refreshBtn.onmouseout = () => refreshBtn.style.background = '#9333EA';
483
 
484
  wrapper.appendChild(refreshBtn);
485
 
 
743
  css = """
744
  @import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');
745
 
746
+ /* Background grid pattern - Purple theme */
747
  body, .gradio-container {
748
+ background-color: #FAF5FF !important;
749
  background-image:
750
+ linear-gradient(#E9D5FF 1px, transparent 1px),
751
+ linear-gradient(90deg, #E9D5FF 1px, transparent 1px) !important;
752
  background-size: 40px 40px !important;
753
  font-family: 'Outfit', sans-serif !important;
754
  }
 
757
  .dark body, .dark .gradio-container {
758
  background-color: #1a1a1a !important;
759
  background-image:
760
+ linear-gradient(rgba(168, 85, 247, 0.1) 1px, transparent 1px),
761
+ linear-gradient(90deg, rgba(168, 85, 247, 0.1) 1px, transparent 1px) !important;
762
  background-size: 40px 40px !important;
763
  }
764
 
 
776
  #main-title h1 {
777
  font-size: 2.4em !important;
778
  font-weight: 700 !important;
779
+ background: linear-gradient(135deg, #A855F7 0%, #C084FC 50%, #9333EA 100%);
780
  background-size: 200% 200%;
781
  -webkit-background-clip: text;
782
  -webkit-text-fill-color: transparent;
 
800
  margin: 0 auto;
801
  color: #666666;
802
  font-size: 1rem;
803
+ text-align: center !important;
804
  }
805
 
806
  #subtitle a {
807
+ color: #A855F7 !important;
808
  text-decoration: none;
809
  font-weight: 500;
810
  }
 
813
  text-decoration: underline;
814
  }
815
 
816
+ /* Center all markdown text */
817
+ .gradio-container > .main > .wrap > .contain > .gap > div:nth-child(2) {
818
+ text-align: center !important;
819
+ }
820
+
821
  /* Card styling */
822
  .gradio-group {
823
  background: rgba(255, 255, 255, 0.9) !important;
824
+ border: 2px solid #E9D5FF !important;
825
  border-radius: 12px !important;
826
+ box-shadow: 0 4px 24px rgba(168, 85, 247, 0.08) !important;
827
  backdrop-filter: blur(10px);
828
  transition: all 0.3s ease;
829
  }
830
 
831
  .gradio-group:hover {
832
+ box-shadow: 0 8px 32px rgba(168, 85, 247, 0.12) !important;
833
+ border-color: #C084FC !important;
834
  }
835
 
836
  .dark .gradio-group {
837
  background: rgba(30, 30, 30, 0.9) !important;
838
+ border-color: rgba(168, 85, 247, 0.3) !important;
839
  }
840
 
841
  /* Image upload area */
842
  .gradio-image {
843
  border-radius: 10px !important;
844
  overflow: hidden;
845
+ border: 2px dashed #C084FC !important;
846
  transition: all 0.3s ease;
847
  }
848
 
849
  .gradio-image:hover {
850
+ border-color: #A855F7 !important;
851
+ background: rgba(168, 85, 247, 0.02) !important;
852
  }
853
 
854
  /* Radio buttons */
 
863
  }
864
 
865
  .gradio-radio label:hover {
866
+ background: rgba(168, 85, 247, 0.05) !important;
867
  }
868
 
869
  .gradio-radio label.selected {
870
+ background: rgba(168, 85, 247, 0.1) !important;
871
+ border-color: #A855F7 !important;
872
  }
873
 
874
  /* Primary button */
 
885
 
886
  /* Tabs styling */
887
  .tab-nav {
888
+ border-bottom: 2px solid #E9D5FF !important;
889
  }
890
 
891
  .tab-nav button {
 
896
  }
897
 
898
  .tab-nav button.selected {
899
+ background: rgba(168, 85, 247, 0.1) !important;
900
+ border-bottom: 2px solid #A855F7 !important;
901
  }
902
 
903
  /* Output textbox */
 
906
  font-size: 0.95rem !important;
907
  line-height: 1.7 !important;
908
  background: rgba(255, 255, 255, 0.95) !important;
909
+ border: 1px solid #E9D5FF !important;
910
  border-radius: 8px !important;
911
  }
912
 
913
  .dark .gradio-textbox textarea {
914
  background: rgba(30, 30, 30, 0.95) !important;
915
+ border-color: rgba(168, 85, 247, 0.2) !important;
916
  }
917
 
918
  /* Markdown output */
 
923
 
924
  .gradio-markdown code {
925
  font-family: 'IBM Plex Mono', monospace !important;
926
+ background: rgba(168, 85, 247, 0.08) !important;
927
  padding: 2px 6px !important;
928
  border-radius: 4px !important;
929
+ color: #7E22CE !important;
930
  }
931
 
932
  .gradio-markdown pre {
933
+ background: rgba(168, 85, 247, 0.05) !important;
934
+ border: 1px solid #E9D5FF !important;
935
  border-radius: 8px !important;
936
  padding: 1rem !important;
937
  }
 
942
  }
943
 
944
  .gradio-examples .gallery-item {
945
+ border: 2px solid #E9D5FF !important;
946
  border-radius: 8px !important;
947
  transition: all 0.2s ease !important;
948
  }
949
 
950
  .gradio-examples .gallery-item:hover {
951
+ border-color: #A855F7 !important;
952
  transform: translateY(-2px) !important;
953
+ box-shadow: 0 4px 12px rgba(168, 85, 247, 0.15) !important;
954
  }
955
 
956
  /* Scrollbar styling */
 
960
  }
961
 
962
  ::-webkit-scrollbar-track {
963
+ background: rgba(168, 85, 247, 0.05);
964
  border-radius: 4px;
965
  }
966
 
967
  ::-webkit-scrollbar-thumb {
968
+ background: linear-gradient(135deg, #A855F7, #C084FC);
969
  border-radius: 4px;
970
  }
971
 
972
  ::-webkit-scrollbar-thumb:hover {
973
+ background: linear-gradient(135deg, #9333EA, #A855F7);
974
  }
975
 
976
  /* Accordion styling */
977
  .gradio-accordion {
978
  border-radius: 10px !important;
979
+ border: 1px solid #E9D5FF !important;
980
  }
981
 
982
  .gradio-accordion > .label-wrap {
983
+ background: rgba(168, 85, 247, 0.03) !important;
984
  border-radius: 10px !important;
985
  }
986
 
 
1015
  }
1016
 
1017
  .gradio-dropdown select, .gradio-dropdown input {
1018
+ border: 1px solid #E9D5FF !important;
1019
  border-radius: 8px !important;
1020
  transition: all 0.2s ease !important;
1021
  }
1022
 
1023
  .gradio-dropdown select:focus, .gradio-dropdown input:focus {
1024
+ border-color: #A855F7 !important;
1025
+ box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.1) !important;
1026
  }
1027
 
1028
  /* Slider styling */
1029
  .gradio-slider input[type="range"] {
1030
+ accent-color: #A855F7 !important;
1031
  }
1032
 
1033
  .gradio-slider .range-slider {
1034
+ background: #E9D5FF !important;
1035
  }
1036
 
1037
  .gradio-slider .range-slider .handle {
1038
+ background: #A855F7 !important;
1039
+ border-color: #A855F7 !important;
1040
  }
1041
 
1042
  /* 3D Control styling */
1043
  #lighting-3d-control {
1044
  min-height: 450px;
1045
+ border: 2px solid #E9D5FF !important;
1046
  border-radius: 12px !important;
1047
  overflow: hidden;
1048
  }
 
1053
  }
1054
 
1055
  .progress-bar {
1056
+ background: linear-gradient(90deg, #A855F7, #C084FC) !important;
1057
  }
1058
 
1059
  /* Checkbox styling */
1060
  .gradio-checkbox input[type="checkbox"]:checked {
1061
+ background-color: #A855F7 !important;
1062
+ border-color: #A855F7 !important;
1063
  }
1064
 
1065
  /* Number input styling */
1066
  .gradio-number input {
1067
+ border: 1px solid #E9D5FF !important;
1068
  border-radius: 8px !important;
1069
  }
1070
 
1071
  .gradio-number input:focus {
1072
+ border-color: #A855F7 !important;
1073
+ box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.1) !important;
1074
  }
1075
 
1076
  /* Gallery styling */
 
1079
  }
1080
 
1081
  .gradio-gallery .gallery-item {
1082
+ border: 2px solid #E9D5FF !important;
1083
  border-radius: 8px !important;
1084
  transition: all 0.2s ease !important;
1085
  }
1086
 
1087
  .gradio-gallery .gallery-item:hover {
1088
+ border-color: #A855F7 !important;
1089
+ box-shadow: 0 4px 12px rgba(168, 85, 247, 0.15) !important;
1090
  }
1091
 
1092
  /* Fillable container */
 
1097
 
1098
  with gr.Blocks() as demo:
1099
  gr.Markdown("# **Qwen-Image-Edit-3D-Lighting-Control**", elem_id="main-title")
1100
+ gr.Markdown("Control lighting directions using the 3D viewport or sliders. Using the [Multi-Angle-Lighting](https://huggingface.co/dx8152/Qwen-Edit-2509-Multi-Angle-Lighting) LoRA for precise lighting control.", elem_id="subtitle")
1101
 
1102
  with gr.Row():
1103
  with gr.Column(scale=1):
 
1229
 
1230
  if __name__ == "__main__":
1231
  head = '<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>'
1232
+ demo.launch(head=head, css=css, theme=purple_theme, mcp_server=True, ssr_mode=False, show_error=True)