romi2001 commited on
Commit
fcb5431
·
verified ·
1 Parent(s): 2ed4b82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -26
app.py CHANGED
@@ -20,19 +20,19 @@ COLOR_PALETTES = {
20
  }
21
  }
22
 
 
23
  RECOMMENDED_LOOKS = {
24
  "Light-Black-Brown": [
25
- {"category": "TOP", "name": "Rust Wrap Blouse", "brand": "SHEIN", "hex": "#C64614", "bg": "#F5E6E1", "url": "https://www.shein.com"},
26
- {"category": "TROUSERS", "name": "Camel Wide-Leg Trousers", "brand": "ASOS", "hex": "#C69E6E", "bg": "#F3EFE3", "url": "https://www.asos.com"},
27
- {"category": "SHOES", "name": "Cognac Leather Mules", "brand": "Zara", "hex": "#9B4E2E", "bg": "#EDE3DD", "url": "https://www.zara.com"},
28
- {"category": "JACKET", "name": "Olive Linen Blazer", "brand": "H&M", "hex": "#8FA160", "bg": "#E9ECE1", "url": "https://www.hm.com"},
29
- {"category": "BAG", "name": "Tan Structured Tote", "brand": "SHEIN", "hex": "#D3B287", "bg": "#F4ECE2", "url": "https://www.shein.com"},
30
- {"category": "DRESS", "name": "Terracotta Midi Slip Dress", "brand": "ASOS", "hex": "#CD6A46", "bg": "#F5E6E1", "url": "https://www.asos.com"}
31
  ]
32
  }
33
 
34
  def build_product_card(item):
35
- """בניית כרטיס מוצר עם מחרוזת פשוטה כדי למנוע בעיות של SyntaxError"""
36
  card_html = '<div class="product-card">'
37
  card_html += f'<div class="card-color-header" style="background-color: {item["bg"]};">'
38
  card_html += f'<div class="prod-bubble" style="background-color: {item["hex"]};"></div>'
@@ -87,21 +87,21 @@ def analyze_and_recommend(image, skin, hair, eye, choice_method):
87
  )
88
 
89
  # ==========================================
90
- # 2. FIXED LOOKMATCH PILL & GRID STYLES
91
  # ==========================================
92
  lookmatch_css = """
93
- body, .gradio-container { background-color: #F8F5F5 !important; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
94
  .gradio-container { max-width: 850px !important; margin: 0 auto !important; padding-top: 20px !important; }
95
  .center-text { text-align: center; }
96
 
97
- /* כותרות */
98
  .prod-cat { font-size: 11px; font-weight: 700; color: #D2527F !important; letter-spacing: 1.5px; text-transform: uppercase; }
99
  .title-main { font-size: 42px; font-weight: 800; color: #111111 !important; margin-bottom: 2px; letter-spacing: -1px; }
100
  .subtitle-main { font-size: 15px; color: #888888 !important; margin-bottom: 30px; }
101
  h3 { font-size: 12px; font-weight: 700; color: #A4A1A1 !important; letter-spacing: 1px; margin-top: 0; margin-bottom: 16px; }
102
 
103
- /* תיקון צבעי טקסט וכפתורים - הכל מוכרח להיות כהה וקריא */
104
- input, select, textarea, .secondary, .wrap, .slots, .single-select, .select-wrap, span, label {
105
  color: #111111 !important;
106
  font-family: -apple-system, BlinkMacSystemFont, sans-serif !important;
107
  }
@@ -111,41 +111,46 @@ input, select, textarea, .secondary, .wrap, .slots, .single-select, .select-wrap
111
  }
112
  div.form { background: transparent !important; border: none !important; box-shadow: none !important; }
113
 
114
- /* עיצוב הטאבים העליונים */
115
  fieldset { display: flex !important; justify-content: center !important; gap: 24px !important; border: none !important; background: transparent !important; }
116
 
117
- /* קופסאות תוצאה */
118
- .section-split { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 24px; }
119
  @media (max-width: 768px) { .section-split { grid-template-columns: 1fr; } }
120
  .results-box { background: #FFFFFF; border-radius: 16px; padding: 24px; border: 1px solid #EFECE8; }
121
  .swatch-grid { display: flex; gap: 20px; justify-content: flex-start; }
122
  .swatch-card { text-align: center; font-size: 12px; color: #666666 !important; width: 64px; }
123
- .swatch-card p { color: #666666 !important; }
124
  .color-bubble { width: 48px; height: 48px; border-radius: 50%; margin: 0 auto 8px auto; border: 1px solid rgba(0,0,0,0.05); }
125
  .tip-text { font-size: 16px; color: #222222 !important; line-height: 1.5; margin: 0; }
126
 
127
- /* גריד כרטיסיות הלבוש */
128
- .outfit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 20px; }
129
- @media (max-width: 768px) { .outfit-grid { grid-template-columns: repeat(2, 1fr); } }
130
- @media (max-width: 480px) { .outfit-grid { grid-template-columns: 1fr; } }
 
 
 
 
 
 
131
 
132
  /* עיצוב כרטיסיות הלבוש */
133
- .product-card { background: #FFFFFF; border: 1px solid #EFECE8; border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 4px 12px rgba(0,0,0,0.01); }
134
  .card-color-header { width: 100%; height: 95px; display: flex; align-items: center; justify-content: center; }
135
  .prod-bubble { width: 46px; height: 46px; border-radius: 50%; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
136
- .prod-meta { padding: 20px; display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
137
  .prod-meta .prod-cat { font-size: 11px; font-weight: 700; color: #D2527F !important; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 4px; }
138
  .prod-title { font-size: 16px; font-weight: 700; color: #111111 !important; margin: 0 0 4px 0; line-height: 1.3; min-height: 42px; display: flex; align-items: center; }
139
  .prod-brand { font-size: 14px; color: #999999 !important; margin-bottom: 16px; display: block; }
140
 
141
- /* כפתורי הרכישה המקוריים בשחור ברור */
142
- .shop-btn { display: block; width: 100%; background: #161617; color: #FFFFFF !important; text-align: center; padding: 12px 0; border-radius: 8px; font-size: 14px; font-weight: 700; text-decoration: none !important; letter-spacing: 0.5px; }
143
  .shop-btn:hover { background: #2D2D2F; }
144
 
145
  /* כפתור הפעולה הראשי */
146
- .primary-action-btn { background: #161617 !important; color: #FFFFFF !important; border: none !important; border-radius: 8px !important; font-weight: 700 !important; font-size: 15px !important; padding: 12px 0 !important; text-transform: uppercase; margin-top: 10px; }
147
 
148
- /* תגיות כפתורי הפילטרים המוצגים למטה */
149
  .pill-container button { background: #FFFFFF !important; border: 1px solid #E3DFDA !important; border-radius: 4px !important; font-size: 11px !important; font-weight: 700 !important; color: #555555 !important; text-transform: uppercase; letter-spacing: 0.5px; }
150
  .footer-note { font-size: 13px; color: #A0A0A0 !important; text-align: center; margin-top: 20px; margin-bottom: 30px; }
151
  """
@@ -178,6 +183,7 @@ with gr.Blocks(css=lookmatch_css) as demo:
178
 
179
  submit_btn = gr.Button("Get my look ✨", elem_classes="primary-action-btn")
180
 
 
181
  with gr.Column(visible=False) as output_dashboard:
182
  gr.Markdown("### YOUR FEATURES")
183
  with gr.Row(elem_classes="pill-container"):
 
20
  }
21
  }
22
 
23
+ # קישורים ישירים לעמודי החיפוש והסינון לפי הצבע המדויק של הפרופיל
24
  RECOMMENDED_LOOKS = {
25
  "Light-Black-Brown": [
26
+ {"category": "TOP", "name": "Rust Wrap Blouse", "brand": "SHEIN", "hex": "#C64614", "bg": "#F5E6E1", "url": "https://www.shein.com/alls/Rust-Blouse-vc-29505.html"},
27
+ {"category": "TROUSERS", "name": "Camel Wide-Leg Trousers", "brand": "ASOS", "hex": "#C69E6E", "bg": "#F3EFE3", "url": "https://www.asos.com/search/?q=camel+wide+leg+trousers"},
28
+ {"category": "SHOES", "name": "Cognac Leather Mules", "brand": "Zara", "hex": "#9B4E2E", "bg": "#EDE3DD", "url": "https://www.zara.com/search?searchTerm=cognac+leather"},
29
+ {"category": "JACKET", "name": "Olive Linen Blazer", "brand": "H&M", "hex": "#8FA160", "bg": "#E9ECE1", "url": "https://2.hm.com/search?q=olive+linen+blazer"},
30
+ {"category": "BAG", "name": "Tan Structured Tote", "brand": "SHEIN", "hex": "#D3B287", "bg": "#F4ECE2", "url": "https://www.shein.com/alls/Tan-Bag-vc-32759.html"},
31
+ {"category": "DRESS", "name": "Terracotta Midi Slip Dress", "brand": "ASOS", "hex": "#CD6A46", "bg": "#F5E6E1", "url": "https://www.asos.com/search/?q=terracotta+midi+dress"}
32
  ]
33
  }
34
 
35
  def build_product_card(item):
 
36
  card_html = '<div class="product-card">'
37
  card_html += f'<div class="card-color-header" style="background-color: {item["bg"]};">'
38
  card_html += f'<div class="prod-bubble" style="background-color: {item["hex"]};"></div>'
 
87
  )
88
 
89
  # ==========================================
90
+ # 2. EXACT ORIGINAL LOOKMATCH PILL & GRID STYLES
91
  # ==========================================
92
  lookmatch_css = """
93
+ body, .gradio-container { background-color: #F8F5F5 !important; font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
94
  .gradio-container { max-width: 850px !important; margin: 0 auto !important; padding-top: 20px !important; }
95
  .center-text { text-align: center; }
96
 
97
+ /* כותרות ומלל */
98
  .prod-cat { font-size: 11px; font-weight: 700; color: #D2527F !important; letter-spacing: 1.5px; text-transform: uppercase; }
99
  .title-main { font-size: 42px; font-weight: 800; color: #111111 !important; margin-bottom: 2px; letter-spacing: -1px; }
100
  .subtitle-main { font-size: 15px; color: #888888 !important; margin-bottom: 30px; }
101
  h3 { font-size: 12px; font-weight: 700; color: #A4A1A1 !important; letter-spacing: 1px; margin-top: 0; margin-bottom: 16px; }
102
 
103
+ /* תיקון קריטי: מניעת כיתוב לבן נעלם בגרדיו 6 */
104
+ input, select, textarea, .secondary, .wrap, .slots, .single-select, .select-wrap, span, label, button, p {
105
  color: #111111 !important;
106
  font-family: -apple-system, BlinkMacSystemFont, sans-serif !important;
107
  }
 
111
  }
112
  div.form { background: transparent !important; border: none !important; box-shadow: none !important; }
113
 
114
+ /* יישור טאבים */
115
  fieldset { display: flex !important; justify-content: center !important; gap: 24px !important; border: none !important; background: transparent !important; }
116
 
117
+ /* קופסאות בלוק תוצאה */
118
+ .section-split { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 24px; width: 100% !important; }
119
  @media (max-width: 768px) { .section-split { grid-template-columns: 1fr; } }
120
  .results-box { background: #FFFFFF; border-radius: 16px; padding: 24px; border: 1px solid #EFECE8; }
121
  .swatch-grid { display: flex; gap: 20px; justify-content: flex-start; }
122
  .swatch-card { text-align: center; font-size: 12px; color: #666666 !important; width: 64px; }
 
123
  .color-bubble { width: 48px; height: 48px; border-radius: 50%; margin: 0 auto 8px auto; border: 1px solid rgba(0,0,0,0.05); }
124
  .tip-text { font-size: 16px; color: #222222 !important; line-height: 1.5; margin: 0; }
125
 
126
+ /* תיקון גריד מלא: מניעת דחיסה הצידה וחיתוכים */
127
+ .outfit-grid {
128
+ display: grid !important;
129
+ grid-template-columns: repeat(3, 1fr) !important;
130
+ gap: 20px !important;
131
+ margin-top: 20px !important;
132
+ width: 100% !important;
133
+ }
134
+ @media (max-width: 768px) { .outfit-grid { grid-template-columns: repeat(2, 1fr) !important; } }
135
+ @media (max-width: 480px) { .outfit-grid { grid-template-columns: 1fr !important; } }
136
 
137
  /* עיצוב כרטיסיות הלבוש */
138
+ .product-card { background: #FFFFFF; border: 1px solid #EFECE8; border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 4px 12px rgba(0,0,0,0.01); width: 100% !important; }
139
  .card-color-header { width: 100%; height: 95px; display: flex; align-items: center; justify-content: center; }
140
  .prod-bubble { width: 46px; height: 46px; border-radius: 50%; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
141
+ .prod-meta { padding: 20px; display: flex; flex-direction: column; align-items: flex-start; text-align: left; width: 100%; }
142
  .prod-meta .prod-cat { font-size: 11px; font-weight: 700; color: #D2527F !important; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 4px; }
143
  .prod-title { font-size: 16px; font-weight: 700; color: #111111 !important; margin: 0 0 4px 0; line-height: 1.3; min-height: 42px; display: flex; align-items: center; }
144
  .prod-brand { font-size: 14px; color: #999999 !important; margin-bottom: 16px; display: block; }
145
 
146
+ /* כפתורי הרכישה - שחור בולט וברור */
147
+ .shop-btn { display: block; width: 100%; background: #161617; color: #FFFFFF !important; text-align: center; padding: 12px 0; border-radius: 8px; font-size: 14px; font-weight: 700; text-decoration: none !important; letter-spacing: 0.5px; box-sizing: border-box; }
148
  .shop-btn:hover { background: #2D2D2F; }
149
 
150
  /* כפתור הפעולה הראשי */
151
+ .primary-action-btn { background: #161617 !important; color: #FFFFFF !important; border: none !important; border-radius: 8px !important; font-weight: 700 !important; font-size: 15px !important; padding: 12px 0 !important; text-transform: uppercase; margin-top: 10px; width: 100% !important; }
152
 
153
+ /* פילטרים תחתונים */
154
  .pill-container button { background: #FFFFFF !important; border: 1px solid #E3DFDA !important; border-radius: 4px !important; font-size: 11px !important; font-weight: 700 !important; color: #555555 !important; text-transform: uppercase; letter-spacing: 0.5px; }
155
  .footer-note { font-size: 13px; color: #A0A0A0 !important; text-align: center; margin-top: 20px; margin-bottom: 30px; }
156
  """
 
183
 
184
  submit_btn = gr.Button("Get my look ✨", elem_classes="primary-action-btn")
185
 
186
+ # הסרת המיקום בעמודות פנימיות כדי למנוע את החיתוך הצידה
187
  with gr.Column(visible=False) as output_dashboard:
188
  gr.Markdown("### YOUR FEATURES")
189
  with gr.Row(elem_classes="pill-container"):