MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / generate_constrained_layout

Function generate_constrained_layout

PosterAgent/tree_split_layout.py:590–616  ·  view source on GitHub ↗
(paper_panels, poster_w, poster_h, title_height_ratio=0.1)

Source from the content-addressed store, hash-verified

588 return top_box, bottom_box
589
590def generate_constrained_layout(paper_panels, poster_w, poster_h, title_height_ratio=0.1):
591 # Find title panel explicitly
592 try:
593 title_panel = next(p for p in paper_panels if ('title' in p["section_name"].lower()))
594 other_panels = [p for p in paper_panels if ('title' not in p["section_name"].lower())]
595 except StopIteration:
596 print('Oops, no title found, please try again.')
597 raise
598
599 title_h = poster_h * title_height_ratio
600 title_layout = {
601 "panel_name": title_panel["section_name"],
602 "panel_id": title_panel["panel_id"],
603 "x": 0, "y": 0,
604 "width": poster_w, "height": title_h
605 }
606
607 # Generate recursive layout on remaining space for other panels
608 layout_loss, remaining_layout = panel_layout_generation(
609 other_panels,
610 x=0, y=title_h,
611 w=poster_w, h=poster_h - title_h
612 )
613
614 # Combine title panel with others
615 complete_layout = [title_layout] + remaining_layout
616 return layout_loss, complete_layout
617
618
619def main_inference(

Callers 1

main_inferenceFunction · 0.70

Calls 1

panel_layout_generationFunction · 0.70

Tested by

no test coverage detected