Spaces:
Running
Running
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -334,10 +334,13 @@ def run_benchmark(query):
|
|
| 334 |
vectors_scanned_pct = (vectors_scanned / total_vectors) * 100 if total_vectors > 0 else 0
|
| 335 |
|
| 336 |
# Calculate Recall for Optimized (vs Baseline)
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
|
|
|
|
|
|
|
|
|
| 341 |
else:
|
| 342 |
recall = 0.0
|
| 343 |
|
|
|
|
| 334 |
vectors_scanned_pct = (vectors_scanned / total_vectors) * 100 if total_vectors > 0 else 0
|
| 335 |
|
| 336 |
# Calculate Recall for Optimized (vs Baseline)
|
| 337 |
+
# Use content matching (payload) because IDs might differ if indexed separately
|
| 338 |
+
base_contents = set(p.payload.get('text', str(p.payload)) for p in base_results)
|
| 339 |
+
prod_contents = set(p.payload.get('text', str(p.payload)) for p in prod_results)
|
| 340 |
+
|
| 341 |
+
if base_contents:
|
| 342 |
+
intersection = len(base_contents.intersection(prod_contents))
|
| 343 |
+
recall = (intersection / len(base_contents)) * 100
|
| 344 |
else:
|
| 345 |
recall = 0.0
|
| 346 |
|