Spaces:
Running
Running
Fix np.median float casting in app.py
Browse filesFiles changed (2)
- Dockerfile+1-1
- ocr_webapp/app.py+4-4
12345FROM python:3.11-slim# Rebuild timestamp: 2026-07-30T10:10:30Z - Add scikit-image & fix base64 decodeENV DEBIAN_FRONTEND=noninteractive12345FROM python:3.11-slim# Rebuild timestamp: 2026-07-30T10:19:20Z - Add float casting to np.median in app.pyENV DEBIAN_FRONTEND=noninteractive
396 unmodified lines397398399400401402403404381 unmodified lines786787788789790791792793396 unmodified linesreturn [], []img_h, img_w, _ = img.shapeheights = [e - s for s, e in base_coords]median_line_height = np.median(heights)# [Pre-compute legacy bounds, CCA, etc., identical to original until Phase 1]gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)381 unmodified linesbest_score = cand_data[selected_ctype]["confidence"]cand_data[selected_ctype]["sanity_score"] = best_scoreelse:run_lengths = [c["pred_length"] for c in cand_data.values() if c["pred_length"] > 0]median_len = np.median(run_lengths) if run_lengths else 0best_score = -1.0selected_ctype = "safe" if "safe" in cand_data else "tight"396 unmodified lines397398399400401402403404381 unmodified lines786787788789790791792793396 unmodified linesreturn [], []img_h, img_w, _ = img.shapeheights = [float(e - s) for s, e in base_coords]median_line_height = float(np.median(heights)) if heights else 30.0# [Pre-compute legacy bounds, CCA, etc., identical to original until Phase 1]gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)381 unmodified linesbest_score = cand_data[selected_ctype]["confidence"]cand_data[selected_ctype]["sanity_score"] = best_scoreelse:run_lengths = [float(c["pred_length"]) for c in cand_data.values() if c["pred_length"] > 0]median_len = float(np.median(run_lengths)) if run_lengths else 0.0best_score = -1.0selected_ctype = "safe" if "safe" in cand_data else "tight"
Dockerfile+1-1
ocr_webapp/app.py+4-4