kosmoscpp commited on
Commit
5f5f45e
·
verified ·
1 Parent(s): 9b24812

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -63,6 +63,7 @@ def render_products(products):
63
  url = row.get("url", "#")
64
  category = row.get("category", "Eco Product")
65
  in_stock_text = row.get("inStockText", "")
 
66
 
67
  # Impact message
68
  impact_msg = ""
@@ -73,7 +74,7 @@ def render_products(products):
73
  img_html = f"<img src='{row['img_url']}' style='width:120px; height:120px; object-fit:cover; border-radius:10px;'/>" if row.get("img_url") else ""
74
 
75
  html += f"""
76
- <div class="card" title="Rating: {rating}">
77
  {img_html}
78
  <h3>{title}</h3>
79
  <p class="price">{price}</p>
@@ -146,8 +147,9 @@ threading.Thread(target=cycle_quotes, daemon=True).start()
146
  # --- Gradio UI ---
147
  with gr.Blocks(css="""
148
  body {background: #0d1117; color: #e6edf3; font-family: 'Segoe UI', sans-serif;}
149
- .card {backdrop-filter: blur(12px); background: rgba(255,255,255,0.05); border-radius: 16px; padding: 20px; margin: 10px; box-shadow: 0 0 15px rgba(0,255,150,0.2); transition: transform 0.2s ease; display:inline-block; vertical-align:top; width:200px; text-align:center;}
150
  .card:hover {transform: scale(1.05); box-shadow: 0 0 25px rgba(0,255,150,0.5);}
 
151
  .price {color: #39ff14; font-weight: bold;}
152
  a {color: #58a6ff; text-decoration: none;}
153
  a:hover {text-decoration: underline;}
 
63
  url = row.get("url", "#")
64
  category = row.get("category", "Eco Product")
65
  in_stock_text = row.get("inStockText", "")
66
+ description = row.get("description", "No description available.")
67
 
68
  # Impact message
69
  impact_msg = ""
 
74
  img_html = f"<img src='{row['img_url']}' style='width:120px; height:120px; object-fit:cover; border-radius:10px;'/>" if row.get("img_url") else ""
75
 
76
  html += f"""
77
+ <div class="card" title="Rating: {rating}" data-desc="{description}">
78
  {img_html}
79
  <h3>{title}</h3>
80
  <p class="price">{price}</p>
 
147
  # --- Gradio UI ---
148
  with gr.Blocks(css="""
149
  body {background: #0d1117; color: #e6edf3; font-family: 'Segoe UI', sans-serif;}
150
+ .card {backdrop-filter: blur(12px); background: rgba(255,255,255,0.05); border-radius: 16px; padding: 20px; margin: 10px; box-shadow: 0 0 15px rgba(0,255,150,0.2); transition: transform 0.2s ease; display:inline-block; vertical-align:top; width:200px; text-align:center; position: relative;}
151
  .card:hover {transform: scale(1.05); box-shadow: 0 0 25px rgba(0,255,150,0.5);}
152
+ .card:hover::after {content: attr(data-desc); position: absolute; top: 0; left: 210px; width: 250px; background: rgba(0,0,0,0.85); color: #fff; padding: 10px; border-radius: 8px; font-size: 0.85em; z-index: 10; white-space: normal; box-shadow: 0 0 10px rgba(0,255,150,0.3);}
153
  .price {color: #39ff14; font-weight: bold;}
154
  a {color: #58a6ff; text-decoration: none;}
155
  a:hover {text-decoration: underline;}