Spaces:
Sleeping
Sleeping
Update app.py
Browse files438 unmodified lines43944044144244344426 unmodified lines4714724734744754764774781 unmodified line480481482483484485486487488489490491438 unmodified linesdef export_pdf(heatmap_img, chart_img, summary_md):if heatmap_img is None or not summary_md:return Nonestyles = getSampleStyleSheet()tmp_dir = tempfile.gettempdir()pdf_path = os.path.join(tmp_dir, "design_analysis_report.pdf")26 unmodified linesfor i in range(len(ordered) - 1):pt1 = (ordered[i]["cx"], ordered[i]["cy"])pt2 = (ordered[i + 1]["cx"], ordered[i + 1]["cy"])cv2.arrowedLine(img, pt1, pt2, (255, 255, 255), 4, tipLength=0.06, line_type=cv2.LINE_AA)cv2.arrowedLine(img, pt1, pt2, (20, 20, 20), 2, tipLength=0.06, line_type=cv2.LINE_AA)return img1 unmodified lineimg = overlay_bgr.copy()for i, z in enumerate(zones, 1):cx, cy = z["cx"], z["cy"]radius = 16cv2.circle(img, (cx, cy), radius, (255, 255, 255), -1)cv2.circle(img, (cx, cy), radius, (0, 0, 0), 2)text = str(i)(tw, th), _ = cv2.getTextSize(text, cv2.FONT_HERSHEY_SIMPLEX, 0.6, 2)cv2.putText(img, text, (cx - tw // 2, cy + th // 2), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 0, 0), 2, cv2.LINE_AA)return img438 unmodified lines43944044144244344444544644744826 unmodified lines4754764774784794804814821 unmodified line484485486487488489490491492493494495438 unmodified linesdef export_pdf(heatmap_img, chart_img, summary_md):if heatmap_img is None or not summary_md:return Noneif isinstance(heatmap_img, np.ndarray):heatmap_img = Image.fromarray(heatmap_img)if chart_img is not None and isinstance(chart_img, np.ndarray):chart_img = Image.fromarray(chart_img)styles = getSampleStyleSheet()tmp_dir = tempfile.gettempdir()pdf_path = os.path.join(tmp_dir, "design_analysis_report.pdf")26 unmodified linesfor i in range(len(ordered) - 1):pt1 = (ordered[i]["cx"], ordered[i]["cy"])pt2 = (ordered[i + 1]["cx"], ordered[i + 1]["cy"])cv2.arrowedLine(img, pt1, pt2, (0, 0, 0), 8, tipLength=0.08, line_type=cv2.LINE_AA)cv2.arrowedLine(img, pt1, pt2, (0, 255, 255), 4, tipLength=0.08, line_type=cv2.LINE_AA)return img1 unmodified lineimg = overlay_bgr.copy()for i, z in enumerate(zones, 1):cx, cy = z["cx"], z["cy"]radius = 22cv2.circle(img, (cx, cy), radius, (255, 255, 255), -1)cv2.circle(img, (cx, cy), radius, (0, 0, 0), 3)text = str(i)(tw, th), _ = cv2.getTextSize(text, cv2.FONT_HERSHEY_SIMPLEX, 0.9, 3)cv2.putText(img, text, (cx - tw // 2, cy + th // 2), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 0, 0), 3, cv2.LINE_AA)return img
app.py+10-6