sachithcheruvaturfynd commited on
Commit
bfdc54b
·
verified ·
1 Parent(s): a0d2dec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -57,13 +57,15 @@ selected_product_id = product_name_to_id.get(selected_product_name)
57
 
58
  # Display the image of the selected product using the image URL
59
  if selected_product_id:
 
60
  #st.subheader(f"Selected Product: {selected_product_name}")
61
 
62
  # Check if the product's ID has an associated image HTML and use the image URL
63
  if selected_product_id in uid_image_html_pairs:
64
  image_url = uid_image_html_pairs[selected_product_id]
65
  st.image(image_url, use_column_width=False, width=450) # Set width to make image smaller
66
- st.write("Cost of chosen item:", str(round(item_costs_sephora_data[selected_product_id], 2)))
 
67
 
68
 
69
  # Display recommendations for the selected product
@@ -85,7 +87,7 @@ if selected_product_id:
85
  for recommendation in recommendations:
86
  product_name = recommendation.get('product_name')
87
  recommended_product_id = recommendation.get('product_id')
88
- recommended_product_cost = item_costs_sephora_data.get(recommended_product_id, "item missing")
89
 
90
  # Display the image of each recommended product using the image URL
91
  if recommended_product_id in uid_image_html_pairs:
@@ -97,7 +99,6 @@ if selected_product_id:
97
  reccomendation_costs.append(recommended_product_cost)
98
 
99
  # Display the product name
100
- #st.write(f"Product Name: {product_name}")
101
  else:
102
  st.write("No recommendations found for this product.")
103
 
@@ -108,7 +109,7 @@ if selected_product_id:
108
  mid_section += f"""<div class="item">
109
  <div id="image-container"><img src='{reccomendation_images[index]}' /></div>
110
  <p style="font-size: 16px; font-weight: bold; white-space: normal; word-wrap: break-word;">{str(reccomendation_names[index])}</p>
111
- <p>{round(reccomendation_costs[index],2)}</p>
112
  </div>"""
113
  mid_html = html2 + mid_section + """</div></div></body>"""
114
  st.markdown(mid_html, unsafe_allow_html=True)
 
57
 
58
  # Display the image of the selected product using the image URL
59
  if selected_product_id:
60
+ #st.write(selected_product_id)
61
  #st.subheader(f"Selected Product: {selected_product_name}")
62
 
63
  # Check if the product's ID has an associated image HTML and use the image URL
64
  if selected_product_id in uid_image_html_pairs:
65
  image_url = uid_image_html_pairs[selected_product_id]
66
  st.image(image_url, use_column_width=False, width=450) # Set width to make image smaller
67
+ items_cost_is = item_costs_sephora_data[str(selected_product_id)]
68
+ st.write("Cost of chosen item:",str(items_cost_is) )
69
 
70
 
71
  # Display recommendations for the selected product
 
87
  for recommendation in recommendations:
88
  product_name = recommendation.get('product_name')
89
  recommended_product_id = recommendation.get('product_id')
90
+ recommended_product_cost = item_costs_sephora_data.get(str(recommended_product_id), "item missing")
91
 
92
  # Display the image of each recommended product using the image URL
93
  if recommended_product_id in uid_image_html_pairs:
 
99
  reccomendation_costs.append(recommended_product_cost)
100
 
101
  # Display the product name
 
102
  else:
103
  st.write("No recommendations found for this product.")
104
 
 
109
  mid_section += f"""<div class="item">
110
  <div id="image-container"><img src='{reccomendation_images[index]}' /></div>
111
  <p style="font-size: 16px; font-weight: bold; white-space: normal; word-wrap: break-word;">{str(reccomendation_names[index])}</p>
112
+ <p>Item Price: {reccomendation_costs[index]}</p>
113
  </div>"""
114
  mid_html = html2 + mid_section + """</div></div></body>"""
115
  st.markdown(mid_html, unsafe_allow_html=True)