Spaces:
Runtime error
Runtime error
Fix: Update UI, Shards (16), and Router Logic
Browse files9 unmodified lines101112131314151673 unmodified lines909192939493949596979810099100101102153 unmodified lines2562572582602612622592602612622632642652652662672682692692702712722731 unmodified line2752762772772782792802812782792802812822832842852862872852882892902913 unmodified lines2952962972952982993003018 unmodified lines3103113123103133143153169 unmodified lines# --- Configuration ---COLLECTION_NAME = "dashVector_v1"VECTOR_SIZE = 384 # MiniLM-L6-v2NUM_CLUSTERS = 32NUM_CLUSTERS = 16EMBEDDING_MODEL = "sentence-transformers/all-MiniLM-L6-v2"
# --- Initialize Backend ---73 unmodified lines<header class="bg-white border-b border-slate-200 sticky top-0 z-40 shadow-sm w-full"> <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-16 flex items-center justify-between"> <div class="flex items-center gap-2"> <!-- User Logo --> <img src="file/logo.png" alt="dashVector Logo" class="h-8 w-auto" /> <!-- User Logo Removed --> <h1 class="text-xl font-bold tracking-tight text-slate-900">dashVector</h1> </div> <div class="flex items-center gap-4"> <div class="hidden md:flex items-center gap-1.5 px-3 py-1 bg-slate-100 rounded-full border border-slate-200"> <span class="material-symbols-outlined text-slate-500 text-sm">database</span> <span class="text-xs font-medium text-slate-600">Dataset: <span class="font-bold text-slate-800">MS Marco</span></span> <span class="text-xs font-medium text-slate-600">Dataset: <span class="font-bold text-slate-800">MS Marco (25k)</span></span> </div> </div> </div>153 unmodified lines
# Router Prediction if router: print("DEBUG: Predicting cluster...") target_cluster, confidence = router.predict(query_vec) print(f"DEBUG: Predicted cluster {target_cluster} with confidence {confidence}") print("DEBUG: Predicting clusters...") # Now returns list of clusters and cumulative confidence target_clusters, confidence = router.predict(query_vec) print(f"DEBUG: Predicted clusters {target_clusters} with cumulative confidence {confidence}") else: print("DEBUG: No router loaded, using mock.") target_cluster, confidence = 0, 0.95 # Mock target_clusters, confidence = [0], 0.95 # Mock # Search print("DEBUG: Searching Qdrant...") # Now accepts list of clusters results, mode = vector_db.search_hybrid(query_vec, target_cluster, confidence) results, mode = vector_db.search_hybrid(query_vec, target_clusters, confidence) print(f"DEBUG: Search complete. Found {len(results)} results.") end_total = time.time()1 unmodified line # Construct Data Rows # Live Row (MiniLM + LightGBM) # Mocking shards searched based on confidence for demo visual shards_searched = 2 if confidence > 0.8 else 33 total_shards = 33 direct_time = latency_ms * (total_shards / shards_searched) * 1.2 # Estimate baseline # Live Row (MiniLM + Logistic Regression) shards_searched = len(target_clusters) total_shards = 16 # Updated to 16 # Estimate baseline time (mock calculation for demo if we don't run full scan) # Or we could actually run full scan if we wanted true comparison, but for speed we estimate direct_time = latency_ms * (total_shards / max(shards_searched, 1)) * 1.1 live_row = { "embedding": "MiniLM-L6-v2 (Active)", "router": "LightGBM", "router": "Logistic Regression", # Updated label "optimizedTime": f"{latency_ms:.1f} ms", "shardsSearched": f"{shards_searched} / {total_shards}", "totalShards": total_shards,3 unmodified lines "efficiency": f"+{((1 - latency_ms/direct_time)*100):.1f}%" } # Reference Rows (Static) # Reference Rows (Static - Updated) ref_rows = [ { "embedding": "Gemma 300M",8 unmodified lines }, { "embedding": "Qwen 600M", "router": "XGBoost", "router": "Tiny MLP", "optimizedTime": "109 ms", "shardsSearched": "7 / 16", "totalShards": 16,app.py+20-17