Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
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 {
|