HamidBekam commited on
Commit
dfe695e
1 Parent(s): 199d8fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -39,8 +39,13 @@ if st.button('Search'):
39
  if user_input:
40
  # Get and display similar products
41
  results = get_similar_products(user_input, stored_products, stored_embeddings)
42
- for product, score in results:
43
- st.write(f"Product: {product} (Score: {score:.4f})")
 
 
 
 
44
  else:
45
  st.write("Please enter a product name or description to search.")
46
 
 
 
39
  if user_input:
40
  # Get and display similar products
41
  results = get_similar_products(user_input, stored_products, stored_embeddings)
42
+
43
+ # Convert results to a DataFrame for nicer display
44
+ results_df = pd.DataFrame(results, columns=['Product', 'Score'])
45
+
46
+ # Use Streamlit's dataframe function to display results in a table with default formatting
47
+ st.dataframe(results_df.style.format({'Score': '{:.4f}'}))
48
  else:
49
  st.write("Please enter a product name or description to search.")
50
 
51
+