crazycrazypete commited on
Commit
c8981b2
·
verified ·
1 Parent(s): d410642

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +34 -0
app.py CHANGED
@@ -602,6 +602,40 @@ def choose_best_parsec(cands: List[Dict[str, Any]], mode: str) -> Dict[str, Any]
602
  best.pop("_card", None)
603
  return best
604
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
605
  def antenna_options_for(router_model: str, tech: str, mimo: str) -> Dict[str, Any]:
606
  q_stationary = f"{router_model} {tech} {mimo} omni stationary pole wall fixed site Parsec"
607
  q_vehicle = f"{router_model} {tech} {mimo} omni vehicle mobile magnetic through-bolt Parsec"
 
602
  best.pop("_card", None)
603
  return best
604
 
605
+
606
+ def infer_mimo_for_5g(model: str, canon_make: str) -> str:
607
+ """Best-effort MIMO guess for antenna selection (2x2 vs 4x4)."""
608
+ # If model is unknown, default to 2x2 (safer ordering)
609
+ if not model or model in {"Not applicable", "Not listed"}:
610
+ return "2x2"
611
+
612
+ # If the model name hints 5G, lean 4x4
613
+ if "5g" in model.lower() or model.upper().startswith(("R", "E", "S", "IX", "RUTM")):
614
+ default = "4x4"
615
+ else:
616
+ default = "2x2"
617
+
618
+ # Use dec2025routers.csv if we can match the model under the same maker family
619
+ try:
620
+ pool = df_dec[df_dec["_canon_make"] == canon_make].copy()
621
+ if pool.empty:
622
+ return default
623
+ hit = process.extractOne(norm_text(model), pool["_norm_model"].tolist(), scorer=fuzz.WRatio)
624
+ if not hit or hit[1] < MATCH_OK:
625
+ return default
626
+ row = pool.iloc[int(hit[2])]
627
+ txt2 = (str(row.get("Antennas (internal/external/both)", "")) + " " + str(row.get("Modem Type", "")) + " " + str(row.get("Special notes",""))).lower()
628
+ if "4x4" in txt2 or "4 x 4" in txt2 or "4x 4" in txt2:
629
+ return "4x4"
630
+ if "2x2" in txt2 or "2 x 2" in txt2:
631
+ return "2x2"
632
+ # If modem type includes 5G, lean 4x4
633
+ if "5g" in txt2 or "nr" in txt2:
634
+ return "4x4"
635
+ return default
636
+ except Exception:
637
+ return default
638
+
639
  def antenna_options_for(router_model: str, tech: str, mimo: str) -> Dict[str, Any]:
640
  q_stationary = f"{router_model} {tech} {mimo} omni stationary pole wall fixed site Parsec"
641
  q_vehicle = f"{router_model} {tech} {mimo} omni vehicle mobile magnetic through-bolt Parsec"