Ashraf-CK commited on
Commit
e38f762
·
verified ·
1 Parent(s): 9b06494

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -80,12 +80,9 @@ def search_products(
80
  start_idx = (page - 1) * items_per_page
81
  end_idx = start_idx + items_per_page
82
  paginated_indices = ranked_indices[start_idx:end_idx]
83
-
84
- # Prepare Response
85
- results = []
86
- for idx in paginated_indices:
87
- item = dataset[idx]
88
- results.append(item)
89
 
90
  # Construct the API response
91
  return {
 
80
  start_idx = (page - 1) * items_per_page
81
  end_idx = start_idx + items_per_page
82
  paginated_indices = ranked_indices[start_idx:end_idx]
83
+ # Prepare Response using select()
84
+ paginated_dataset = dataset.select(paginated_indices)
85
+ results = [item for item in paginated_dataset]
 
 
 
86
 
87
  # Construct the API response
88
  return {