romi2001 commited on
Commit
6543d7a
·
verified ·
1 Parent(s): 4cc8d15

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -28
app.py CHANGED
@@ -38,13 +38,11 @@ def analyze_and_recommend(image, skin, hair, eye, choice_method):
38
  palette_key = f"{skin_tone}-{hair_color}-{eye_color}"
39
  palette = COLOR_PALETTES.get(palette_key, COLOR_PALETTES["Fair-Blonde-Blue"])
40
 
41
- # Premium circular swatches with elegant borders
42
  swatches_html = "".join([
43
  f'<div class="swatch-card"><div class="color-bubble" style="background-color: {s["hex"]};"></div><p>{s["name"].upper()}</p></div>'
44
  for s in palette["swatches"]
45
  ])
46
 
47
- # Luxury Editorial-style Product Grid
48
  outfit_html = "".join([
49
  f'''
50
  <div class="product-card">
@@ -89,56 +87,65 @@ def analyze_and_recommend(image, skin, hair, eye, choice_method):
89
  )
90
 
91
  # ==========================================
92
- # 2. CLASSY, HIGH-END EDITORIAL DESIGN THEME
93
  # ==========================================
94
  luxury_css = """
95
- body { background-color: #F6F5F2 !important; font-family: "Didot", "Playfair Display", "Times New Roman", serif; }
96
- .gradio-container { max-width: 800px !important; margin: 0 auto !important; padding-top: 50px !important; }
 
97
  .center-text { text-align: center; }
98
 
99
- /* Typography */
100
  .prod-cat { font-size: 11px; font-weight: 600; color: #8C7A6B; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 8px; }
101
- .title-main { font-size: 48px; font-weight: 700; color: #111111; font-family: "Didot", serif; margin-bottom: 2px; letter-spacing: -1px; }
102
- .subtitle-main { font-size: 14px; font-style: italic; color: #666666; margin-bottom: 40px; letter-spacing: 0.5px; }
103
  h3 { font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 10px; font-weight: 700; color: #8C7A6B; letter-spacing: 2px; margin-bottom: 14px; }
104
 
105
- /* Radio Navigation Tabs */
106
- .gr-radio { display: flex; justify-content: center; gap: 24px; border: none !important; background: transparent !important; }
107
- .gr-radio label { font-family: -apple-system, sans-serif; font-size: 13px !important; text-transform: uppercase; letter-spacing: 1px; color: #777 !important; border-bottom: 2px solid transparent; padding-bottom: 4px; transition: all 0.3s; }
108
- .gr-radio label.selected { color: #111 !important; border-bottom: 2px solid #111 !important; font-weight: 600; }
 
 
 
 
 
 
109
 
110
- /* Input Elements */
111
- .gr-box { border-radius: 0px !important; border: 1px solid #DCD9G6 !important; background-color: #FFFFFF !important; }
 
112
 
113
- /* Main Output Board */
114
  .results-box { background: #FFFFFF; border-radius: 0px; padding: 32px; border: 1px solid #E4E2DF; margin-top: 32px; box-shadow: 0 10px 40px rgba(0,0,0,0.03); }
115
- .palette-banner { background: #111111; color: #FFFFFF; padding: 32px; border-radius: 0px; margin-bottom: 32px; text-align: center; border-bottom: 3px solid #D4AF37; }
116
- .editorial-tag { font-size: 9px; font-weight: 700; color: #D4AF37; letter-spacing: 3px; display: block; margin-bottom: 8px; font-family: -apple-system, sans-serif; }
117
- .palette-banner h2 { font-family: "Didot", serif; font-size: 36px; font-weight: 400; margin: 0 0 6px 0; letter-spacing: 1px; }
118
- .banner-desc { font-family: -apple-system, sans-serif; color: #C0C0A0; margin: 0; font-size: 11px; letter-spacing: 1.5px; }
 
119
 
120
  /* Section Grid Splits */
121
  .section-split { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 32px; margin-bottom: 16px; }
122
  @media (max-width: 768px) { .section-split { grid-template-columns: 1fr; } }
123
  .swatch-grid { display: flex; gap: 20px; }
124
- .swatch-card { text-align: center; font-family: -apple-system, sans-serif; font-size: 10px; font-weight: 600; color: #444; letter-spacing: 0.5px; }
125
  .color-bubble { width: 48px; height: 48px; border-radius: 50%; margin: 0 auto 10px auto; border: 1px solid rgba(0,0,0,0.08); box-shadow: inset 0 0 0 2px #FFFFFF; }
126
  .tip-box { background: #FAF9F6; padding: 24px; border-left: 2px solid #D4AF37; }
127
- .tip-box p { font-size: 14px; font-style: italic; color: #444; line-height: 1.6; margin: 0; }
128
 
129
- /* Luxury E-Commerce Product Grid */
130
  .outfit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 24px; }
131
  @media (max-width: 640px) { .outfit-grid { grid-template-columns: repeat(2, 1fr); } }
132
  .product-card { background: #FFFFFF; border: 1px solid #EAE8E4; border-radius: 0px; padding: 20px; display: flex; flex-direction: column; align-items: center; text-align: center; transition: transform 0.3s; }
133
  .product-card:hover { transform: translateY(-4px); border-color: #D4AF37; }
134
  .prod-bubble { width: 32px; height: 36px; border-radius: 4px; margin-bottom: 14px; border: 1px solid rgba(0,0,0,0.05); }
135
- .prod-title { font-family: "Didot", serif; font-size: 15px; font-weight: 500; color: #111; margin: 6px 0; min-height: 44px; display: flex; align-items: center; line-height: 1.3; }
136
- .prod-brand { font-family: -apple-system, sans-serif; font-size: 10px; font-weight: 700; color: #888; letter-spacing: 1px; margin-bottom: 16px; }
137
 
138
- /* Premium CTA Styling */
139
  .shop-btn { display: block; width: 100%; background: transparent; color: #111111 !important; text-align: center; padding: 10px 0; border: 1px solid #111111; font-family: -apple-system, sans-serif; font-size: 11px; font-weight: 600; letter-spacing: 1px; text-decoration: none !important; transition: all 0.2s; }
140
  .shop-btn:hover { background: #111111; color: #FFFFFF !important; }
141
- .primary-action-btn { background: #111111 !important; color: #FFFFFF !important; border: none !important; border-radius: 0px !important; font-family: -apple-system, sans-serif; font-weight: 600 !important; font-size: 14px !important; letter-spacing: 2px !important; padding: 14px 0 !important; text-transform: uppercase; }
142
  .primary-action-btn:hover { background: #2A2A2A !important; }
143
  .pill-container button { background: #FAF9F6 !important; border: 1px solid #E4E2DF !important; border-radius: 0px !important; font-family: -apple-system, sans-serif; font-size: 11px !important; font-weight: 600 !important; color: #555 !important; letter-spacing: 1px; text-transform: uppercase; }
144
  """
@@ -171,7 +178,6 @@ with gr.Blocks(css=luxury_css) as demo:
171
 
172
  submit_btn = gr.Button("ANALYZE PROFILE", elem_classes="primary-action-btn")
173
 
174
- # Lower Dashboard Area (Revealed on click)
175
  with gr.Column(visible=False) as output_dashboard:
176
  gr.Markdown("### DETECTED SPECIFICATIONS")
177
  with gr.Row(elem_classes="pill-container"):
@@ -184,7 +190,6 @@ with gr.Blocks(css=luxury_css) as demo:
184
  gr.Markdown("### CURATED EDITORIAL OUTFIT PICKS")
185
  outfit_output = gr.HTML(elem_classes="outfit-grid")
186
 
187
- # Navigation controller
188
  def toggle_input_ui(choice):
189
  if choice == "Choose manually":
190
  return gr.update(visible=False), gr.update(visible=True)
 
38
  palette_key = f"{skin_tone}-{hair_color}-{eye_color}"
39
  palette = COLOR_PALETTES.get(palette_key, COLOR_PALETTES["Fair-Blonde-Blue"])
40
 
 
41
  swatches_html = "".join([
42
  f'<div class="swatch-card"><div class="color-bubble" style="background-color: {s["hex"]};"></div><p>{s["name"].upper()}</p></div>'
43
  for s in palette["swatches"]
44
  ])
45
 
 
46
  outfit_html = "".join([
47
  f'''
48
  <div class="product-card">
 
87
  )
88
 
89
  # ==========================================
90
+ # 2. FIXED GRADIO 6 LUXURY EDITORIAL THEME
91
  # ==========================================
92
  luxury_css = """
93
+ /* Core luxury container styles */
94
+ body, .gradio-container { background-color: #F6F5F2 !important; font-family: "Didot", "Playfair Display", serif; }
95
+ .gradio-container { max-width: 800px !important; margin: 0 auto !important; padding-top: 40px !important; }
96
  .center-text { text-align: center; }
97
 
98
+ /* Header Typography */
99
  .prod-cat { font-size: 11px; font-weight: 600; color: #8C7A6B; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 8px; }
100
+ .title-main { font-size: 46px; font-weight: 700; color: #111111; font-family: "Didot", serif; margin-bottom: 2px; letter-spacing: -1px; }
101
+ .subtitle-main { font-size: 14px; font-style: italic; color: #666666; margin-bottom: 32px; letter-spacing: 0.5px; }
102
  h3 { font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 10px; font-weight: 700; color: #8C7A6B; letter-spacing: 2px; margin-bottom: 14px; }
103
 
104
+ /* CRITICAL FIX: Gradio 6 Input & Dropdown Text Visibility */
105
+ input, select, textarea, .secondary, .wrap, .slots, .single-select, .select-wrap, span {
106
+ color: #111111 !important;
107
+ font-family: -apple-system, BlinkMacSystemFont, sans-serif !important;
108
+ }
109
+ .gr-box, .secondary, input, select {
110
+ background-color: #FFFFFF !important;
111
+ border: 1px solid #DCD9D6 !important;
112
+ border-radius: 0px !important;
113
+ }
114
 
115
+ /* CRITICAL FIX: Gradio 6 Radio Elements Restoration */
116
+ div.form { background: transparent !important; border: none !important; box-shadow: none !important; }
117
+ .gr-radio, fieldset { display: flex !important; justify-content: center !important; gap: 24px !important; border: none !important; background: transparent !important; }
118
 
119
+ /* Main Results Board Output */
120
  .results-box { background: #FFFFFF; border-radius: 0px; padding: 32px; border: 1px solid #E4E2DF; margin-top: 32px; box-shadow: 0 10px 40px rgba(0,0,0,0.03); }
121
+ .palette-banner { background: #111111; color: #FFFFFF !important; padding: 32px; border-radius: 0px; margin-bottom: 32px; text-align: center; border-bottom: 3px solid #D4AF37; }
122
+ .palette-banner h2, .palette-banner p, .palette-banner span { color: #FFFFFF !important; }
123
+ .editorial-tag { font-size: 9px; font-weight: 700; color: #D4AF37 !important; letter-spacing: 3px; display: block; margin-bottom: 8px; font-family: -apple-system, sans-serif; }
124
+ .palette-banner h2 { font-family: "Didot", serif; font-size: 34px; font-weight: 400; margin: 0 0 6px 0; letter-spacing: 1px; }
125
+ .banner-desc { font-family: -apple-system, sans-serif; color: #C0C0A0 !important; margin: 0; font-size: 11px; letter-spacing: 1.5px; }
126
 
127
  /* Section Grid Splits */
128
  .section-split { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 32px; margin-bottom: 16px; }
129
  @media (max-width: 768px) { .section-split { grid-template-columns: 1fr; } }
130
  .swatch-grid { display: flex; gap: 20px; }
131
+ .swatch-card { text-align: center; font-family: -apple-system, sans-serif; font-size: 10px; font-weight: 600; color: #444 !important; letter-spacing: 0.5px; }
132
  .color-bubble { width: 48px; height: 48px; border-radius: 50%; margin: 0 auto 10px auto; border: 1px solid rgba(0,0,0,0.08); box-shadow: inset 0 0 0 2px #FFFFFF; }
133
  .tip-box { background: #FAF9F6; padding: 24px; border-left: 2px solid #D4AF37; }
134
+ .tip-box p { font-size: 14px; font-style: italic; color: #444 !important; line-height: 1.6; margin: 0; }
135
 
136
+ /* Luxury Product Grid */
137
  .outfit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 24px; }
138
  @media (max-width: 640px) { .outfit-grid { grid-template-columns: repeat(2, 1fr); } }
139
  .product-card { background: #FFFFFF; border: 1px solid #EAE8E4; border-radius: 0px; padding: 20px; display: flex; flex-direction: column; align-items: center; text-align: center; transition: transform 0.3s; }
140
  .product-card:hover { transform: translateY(-4px); border-color: #D4AF37; }
141
  .prod-bubble { width: 32px; height: 36px; border-radius: 4px; margin-bottom: 14px; border: 1px solid rgba(0,0,0,0.05); }
142
+ .prod-title { font-family: "Didot", serif; font-size: 15px; font-weight: 500; color: #111 !important; margin: 6px 0; min-height: 44px; display: flex; align-items: center; line-height: 1.3; }
143
+ .prod-brand { font-family: -apple-system, sans-serif; font-size: 10px; font-weight: 700; color: #888 !important; letter-spacing: 1px; margin-bottom: 16px; }
144
 
145
+ /* Buttons & CTA Action Points */
146
  .shop-btn { display: block; width: 100%; background: transparent; color: #111111 !important; text-align: center; padding: 10px 0; border: 1px solid #111111; font-family: -apple-system, sans-serif; font-size: 11px; font-weight: 600; letter-spacing: 1px; text-decoration: none !important; transition: all 0.2s; }
147
  .shop-btn:hover { background: #111111; color: #FFFFFF !important; }
148
+ .primary-action-btn { background: #111111 !important; color: #FFFFFF !important; border: none !important; border-radius: 0px !important; font-family: -apple-system, sans-serif; font-weight: 600 !important; font-size: 14px !important; letter-spacing: 2px !important; padding: 14px 0 !important; text-transform: uppercase; margin-top: 10px; }
149
  .primary-action-btn:hover { background: #2A2A2A !important; }
150
  .pill-container button { background: #FAF9F6 !important; border: 1px solid #E4E2DF !important; border-radius: 0px !important; font-family: -apple-system, sans-serif; font-size: 11px !important; font-weight: 600 !important; color: #555 !important; letter-spacing: 1px; text-transform: uppercase; }
151
  """
 
178
 
179
  submit_btn = gr.Button("ANALYZE PROFILE", elem_classes="primary-action-btn")
180
 
 
181
  with gr.Column(visible=False) as output_dashboard:
182
  gr.Markdown("### DETECTED SPECIFICATIONS")
183
  with gr.Row(elem_classes="pill-container"):
 
190
  gr.Markdown("### CURATED EDITORIAL OUTFIT PICKS")
191
  outfit_output = gr.HTML(elem_classes="outfit-grid")
192
 
 
193
  def toggle_input_ui(choice):
194
  if choice == "Choose manually":
195
  return gr.update(visible=False), gr.update(visible=True)