camphong24032002 commited on
Commit
e172f19
1 Parent(s): d176aff
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -17,17 +17,18 @@ def text_preprocessing(text):
17
 
18
  return ' '.join(keywords)
19
 
 
 
 
20
  def df_to_text(df):
21
  text = []
 
 
22
  for data in df:
23
- text.append(f"Product ID: {data["ProductID"]} \n \
24
- Product Name: {data["ProductName"]} \n \
25
- Brand: {data["ProductBrand"]} \n \
26
- Gender: {data["Gender"]} \n \
27
- Price (INR): {data["Price (INR)"]} \n \
28
- Description: {data["Description"]} \n \
29
- Primary color: {data["PrimaryColor"]}")
30
- return '\n\n'.join(text)
31
 
32
 
33
  df = pd.read_csv("data/dataset.csv").reset_index(drop=True)
 
17
 
18
  return ' '.join(keywords)
19
 
20
+ def concat_content(title, value):
21
+ return f"{title}: {value}"
22
+
23
  def df_to_text(df):
24
  text = []
25
+ titles = ["Product ID", "Product Name", "Brand", "Gender", "Price (INR)", "Description", "Primary Color"]
26
+ cols = ["ProductID", "ProductName", "ProductBrand", "Gender", "Price (INR)", "Description", "PrimaryColor"]
27
  for data in df:
28
+ for title, col in zip(titles, cols):
29
+ text.append(concat_content(title, col))
30
+ text.append('')
31
+ return '\n'.join(text)
 
 
 
 
32
 
33
 
34
  df = pd.read_csv("data/dataset.csv").reset_index(drop=True)