HaanIlango commited on
Commit
b08811a
·
verified ·
1 Parent(s): fde0a5b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -439,6 +439,10 @@ def markdown_to_paragraphs(md_text, styles):
439
  def export_pdf(heatmap_img, chart_img, summary_md):
440
  if heatmap_img is None or not summary_md:
441
  return None
 
 
 
 
442
  styles = getSampleStyleSheet()
443
  tmp_dir = tempfile.gettempdir()
444
  pdf_path = os.path.join(tmp_dir, "design_analysis_report.pdf")
@@ -471,8 +475,8 @@ def draw_scan_path(overlay_bgr, zones):
471
  for i in range(len(ordered) - 1):
472
  pt1 = (ordered[i]["cx"], ordered[i]["cy"])
473
  pt2 = (ordered[i + 1]["cx"], ordered[i + 1]["cy"])
474
- cv2.arrowedLine(img, pt1, pt2, (255, 255, 255), 4, tipLength=0.06, line_type=cv2.LINE_AA)
475
- cv2.arrowedLine(img, pt1, pt2, (20, 20, 20), 2, tipLength=0.06, line_type=cv2.LINE_AA)
476
  return img
477
 
478
 
@@ -480,12 +484,12 @@ def draw_zone_labels(overlay_bgr, zones):
480
  img = overlay_bgr.copy()
481
  for i, z in enumerate(zones, 1):
482
  cx, cy = z["cx"], z["cy"]
483
- radius = 16
484
  cv2.circle(img, (cx, cy), radius, (255, 255, 255), -1)
485
- cv2.circle(img, (cx, cy), radius, (0, 0, 0), 2)
486
  text = str(i)
487
- (tw, th), _ = cv2.getTextSize(text, cv2.FONT_HERSHEY_SIMPLEX, 0.6, 2)
488
- cv2.putText(img, text, (cx - tw // 2, cy + th // 2), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 0, 0), 2, cv2.LINE_AA)
489
  return img
490
 
491
 
 
439
  def export_pdf(heatmap_img, chart_img, summary_md):
440
  if heatmap_img is None or not summary_md:
441
  return None
442
+ if isinstance(heatmap_img, np.ndarray):
443
+ heatmap_img = Image.fromarray(heatmap_img)
444
+ if chart_img is not None and isinstance(chart_img, np.ndarray):
445
+ chart_img = Image.fromarray(chart_img)
446
  styles = getSampleStyleSheet()
447
  tmp_dir = tempfile.gettempdir()
448
  pdf_path = os.path.join(tmp_dir, "design_analysis_report.pdf")
 
475
  for i in range(len(ordered) - 1):
476
  pt1 = (ordered[i]["cx"], ordered[i]["cy"])
477
  pt2 = (ordered[i + 1]["cx"], ordered[i + 1]["cy"])
478
+ cv2.arrowedLine(img, pt1, pt2, (0, 0, 0), 8, tipLength=0.08, line_type=cv2.LINE_AA)
479
+ cv2.arrowedLine(img, pt1, pt2, (0, 255, 255), 4, tipLength=0.08, line_type=cv2.LINE_AA)
480
  return img
481
 
482
 
 
484
  img = overlay_bgr.copy()
485
  for i, z in enumerate(zones, 1):
486
  cx, cy = z["cx"], z["cy"]
487
+ radius = 22
488
  cv2.circle(img, (cx, cy), radius, (255, 255, 255), -1)
489
+ cv2.circle(img, (cx, cy), radius, (0, 0, 0), 3)
490
  text = str(i)
491
+ (tw, th), _ = cv2.getTextSize(text, cv2.FONT_HERSHEY_SIMPLEX, 0.9, 3)
492
+ cv2.putText(img, text, (cx - tw // 2, cy + th // 2), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 0, 0), 3, cv2.LINE_AA)
493
  return img
494
 
495