Update demo/modules/search.py
Browse files- demo/modules/search.py +1 -2
demo/modules/search.py
CHANGED
@@ -74,13 +74,12 @@ def search(input: str, nprobe: int, topk: int, input_type: str, query_type: str,
|
|
74 |
index = all_index[query_type][db]["index"]
|
75 |
ids = all_index[query_type][db]["ids"]
|
76 |
|
77 |
-
if
|
78 |
if index.nlist < nprobe:
|
79 |
raise gr.Error(f"The number of clusters to search must be less than or equal to the number of clusters in the index ({index.nlist}).")
|
80 |
else:
|
81 |
index.nprobe = nprobe
|
82 |
|
83 |
-
print(nprobe)
|
84 |
if topk > index.ntotal:
|
85 |
raise gr.Error(f"You cannot retrieve more than the database size ({index.ntotal}).")
|
86 |
|
|
|
74 |
index = all_index[query_type][db]["index"]
|
75 |
ids = all_index[query_type][db]["ids"]
|
76 |
|
77 |
+
if hasattr(index, "nprobe"):
|
78 |
if index.nlist < nprobe:
|
79 |
raise gr.Error(f"The number of clusters to search must be less than or equal to the number of clusters in the index ({index.nlist}).")
|
80 |
else:
|
81 |
index.nprobe = nprobe
|
82 |
|
|
|
83 |
if topk > index.ntotal:
|
84 |
raise gr.Error(f"You cannot retrieve more than the database size ({index.ntotal}).")
|
85 |
|