Vermeer commited on
Commit
dfe2f0b
·
verified ·
1 Parent(s): 7973b9f

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +1 -3
  2. utils.py +1 -1
app.py CHANGED
@@ -33,9 +33,7 @@ num_users = 943
33
  def recommend(user_id):
34
 
35
  ground_truth_items, recommendations = utils.predict(lightGCNModel, device, data, num_users, num_items, user_id, train_edge_label_index, k=5)
36
- return ground_truth_items, recommendations
37
-
38
-
39
 
40
  iface = gr.Interface(fn=recommend, inputs="number", outputs=["text", "text"])
41
  iface.launch()
 
33
  def recommend(user_id):
34
 
35
  ground_truth_items, recommendations = utils.predict(lightGCNModel, device, data, num_users, num_items, user_id, train_edge_label_index, k=5)
36
+ return ' '.join(ground_truth_items['title'].tolist()), ' '.join(recommendations)
 
 
37
 
38
  iface = gr.Interface(fn=recommend, inputs="number", outputs=["text", "text"])
39
  iface.launch()
utils.py CHANGED
@@ -56,6 +56,6 @@ def predict(model, device, data, num_users, num_items, user_id, train_edge_label
56
  for index in top_ratings:
57
  asin_of_item = unique_items[index]
58
  recommended_item = meta_dataframe[meta_dataframe['asin'] == asin_of_item]['title'].values
59
- recommended_items.append(recommended_item)
60
 
61
  return ground_truth_items, recommended_items
 
56
  for index in top_ratings:
57
  asin_of_item = unique_items[index]
58
  recommended_item = meta_dataframe[meta_dataframe['asin'] == asin_of_item]['title'].values
59
+ recommended_items.append(recommended_item.item())
60
 
61
  return ground_truth_items, recommended_items