JaceWei commited on
Commit
db6e790
·
1 Parent(s): b3587c5

update: push latest content

Browse files
.gitignore CHANGED
@@ -10,3 +10,5 @@ posterbuilder/latex_proj/figures/
10
  *.mp4
11
  __pycache__/
12
 
 
 
 
10
  *.mp4
11
  __pycache__/
12
 
13
+ # keep logos in template/logos
14
+ !template/logos/**
Paper2Poster/utils/src/model_utils.py CHANGED
@@ -5,7 +5,7 @@ from copy import deepcopy
5
  import numpy as np
6
  # import torch
7
  # import torchvision.transforms as T
8
- from FlagEmbedding import BGEM3FlagModel
9
  from marker.config.parser import ConfigParser
10
  from marker.converters.pdf import PdfConverter
11
  from marker.output import text_from_rendered
@@ -13,7 +13,7 @@ from PIL import Image
13
  # from torchvision.transforms.functional import InterpolationMode
14
  # from transformers import AutoFeatureExtractor, AutoModel
15
 
16
- from utils.src.presentation import Presentation, SlidePage
17
  from utils.src.utils import is_image_path, pjoin
18
 
19
  # device_count = torch.cuda.device_count()
 
5
  import numpy as np
6
  # import torch
7
  # import torchvision.transforms as T
8
+ # from FlagEmbedding import BGEM3FlagModel
9
  from marker.config.parser import ConfigParser
10
  from marker.converters.pdf import PdfConverter
11
  from marker.output import text_from_rendered
 
13
  # from torchvision.transforms.functional import InterpolationMode
14
  # from transformers import AutoFeatureExtractor, AutoModel
15
 
16
+ # from utils.src.presentation import Presentation, SlidePage
17
  from utils.src.utils import is_image_path, pjoin
18
 
19
  # device_count = torch.cuda.device_count()
pipeline.py CHANGED
@@ -50,8 +50,6 @@ def run_paper2poster_content_build():
50
  dst_pdf = P2P_ROOT / "input" / "paper" / "paper.pdf"
51
  dst_pdf.parent.mkdir(parents=True, exist_ok=True)
52
  safe_copy(src_pdf, dst_pdf)
53
- print(f" 📄 Copied paper: {src_pdf.relative_to(ROOT_DIR)} → {dst_pdf.relative_to(ROOT_DIR)}")
54
-
55
  cmd = [
56
  sys.executable, "-m", "PosterAgent.new_pipeline",
57
  f'--poster_path={dst_pdf.relative_to(P2P_ROOT)}',
@@ -173,7 +171,7 @@ def _compose_logos_horizontally(logo_paths, out_path: Path, box_w=2000, box_h=47
173
  if idx != n - 1:
174
  cur_x += gap
175
 
176
- out_path.parent.mkdir(parents=True, exist_ok=True)
177
  canvas.save(out_path, format="PNG")
178
  print(f" 🧩 Logos composed (width-locked) → {out_path.relative_to(ROOT_DIR)} "
179
  f"(n={n}, final_size={canvas_w}x{canvas_h})")
@@ -331,19 +329,6 @@ if __name__ == '__main__':
331
  if len(logo_files) == 0:
332
  raise RuntimeError("❌ No logo files found in --logo_dir (must upload at least one).")
333
 
334
- logos_out_dir = dst_lp / "logos"
335
- logos_out_dir.mkdir(parents=True, exist_ok=True)
336
- left_logo_path = logos_out_dir / "left_logo.png"
337
-
338
- if len(logo_files) == 1:
339
- # 单图:拷贝并转成 PNG(以确保一致)
340
- im = Image.open(logo_files[0]).convert("RGBA")
341
- im.save(left_logo_path, format="PNG")
342
- print(f"🖼️ Single logo saved → {left_logo_path.relative_to(ROOT_DIR)}")
343
- else:
344
- # 多图:拼接
345
- _compose_logos_horizontally(logo_files, left_logo_path, box_w=2000, box_h=476, gap=16)
346
-
347
  template_dir = ROOT_DIR / "template"
348
  if template_dir.exists():
349
  for item in template_dir.iterdir():
@@ -358,6 +343,19 @@ if __name__ == '__main__':
358
  else:
359
  print("⚠️ template directory not found, skipping Step 3.5.")
360
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
  print("✅ Step 3 done.")
362
  except Exception as e:
363
  print(f"❌ Step 3 failed: {e}")
 
50
  dst_pdf = P2P_ROOT / "input" / "paper" / "paper.pdf"
51
  dst_pdf.parent.mkdir(parents=True, exist_ok=True)
52
  safe_copy(src_pdf, dst_pdf)
 
 
53
  cmd = [
54
  sys.executable, "-m", "PosterAgent.new_pipeline",
55
  f'--poster_path={dst_pdf.relative_to(P2P_ROOT)}',
 
171
  if idx != n - 1:
172
  cur_x += gap
173
 
174
+ # out_path.parent.mkdir(parents=True, exist_ok=True)
175
  canvas.save(out_path, format="PNG")
176
  print(f" 🧩 Logos composed (width-locked) → {out_path.relative_to(ROOT_DIR)} "
177
  f"(n={n}, final_size={canvas_w}x{canvas_h})")
 
329
  if len(logo_files) == 0:
330
  raise RuntimeError("❌ No logo files found in --logo_dir (must upload at least one).")
331
 
 
 
 
 
 
 
 
 
 
 
 
 
 
332
  template_dir = ROOT_DIR / "template"
333
  if template_dir.exists():
334
  for item in template_dir.iterdir():
 
343
  else:
344
  print("⚠️ template directory not found, skipping Step 3.5.")
345
 
346
+ logos_out_dir = dst_lp / "logos"
347
+ # logos_out_dir.mkdir(parents=True, exist_ok=True)
348
+ left_logo_path = logos_out_dir / "left_logo.png"
349
+
350
+ if len(logo_files) == 1:
351
+ # 单图:拷贝并转成 PNG(以确保一致)
352
+ im = Image.open(logo_files[0]).convert("RGBA")
353
+ im.save(left_logo_path, format="PNG")
354
+ print(f"🖼️ Single logo saved → {left_logo_path.relative_to(ROOT_DIR)}")
355
+ else:
356
+ # 多图:拼接
357
+ _compose_logos_horizontally(logo_files, left_logo_path, box_w=2000, box_h=476, gap=16)
358
+
359
  print("✅ Step 3 done.")
360
  except Exception as e:
361
  print(f"❌ Step 3 failed: {e}")
posterbuilder/convert.py CHANGED
@@ -430,7 +430,6 @@ def build():
430
 
431
  panels_by_id, figures, cap_full, cap_base = load_arrangement_and_captions()
432
  print(f"✅ Loaded arrangement and captions.")
433
- print(panels_by_id.keys(),figures[:2])
434
  sample_paths = [pathlib.Path(f.get("figure_path","")) for f in figures if f.get("figure_path")]
435
  images_parent = resolve_images_parent_dir(sample_paths)
436
 
 
430
 
431
  panels_by_id, figures, cap_full, cap_base = load_arrangement_and_captions()
432
  print(f"✅ Loaded arrangement and captions.")
 
433
  sample_paths = [pathlib.Path(f.get("figure_path","")) for f in figures if f.get("figure_path")]
434
  images_parent = resolve_images_parent_dir(sample_paths)
435
 
template/logos/right_logo.png ADDED

Git LFS Details

  • SHA256: ae5f368e03bb77bf930b53d9154d7961dc58f605572119598e1cb41b3a9f1ea8
  • Pointer size: 131 Bytes
  • Size of remote file: 103 kB