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

Method caption_images

utils/src/multimodal.py:45–63  ·  view source on GitHub ↗

Generate captions for images in the presentation.

(self)

Source from the content-addressed store, hash-verified

43 shape.caption = stats["caption"]
44
45 def caption_images(self):
46 """
47 Generate captions for images in the presentation.
48 """
49 caption_prompt = open("prompts/caption.txt").read()
50 for image, stats in self.image_stats.items():
51 if "caption" not in stats:
52 stats["caption"] = llms.vision_model(
53 caption_prompt, pjoin(self.config.IMAGE_DIR, image)
54 )
55 print("captioned", image, ": ", stats["caption"])
56 json.dump(
57 self.image_stats,
58 open(self.stats_file, "w"),
59 indent=4,
60 ensure_ascii=False,
61 )
62 self.apply_stats()
63 return self.image_stats
64
65 def collect_images(self):
66 """

Callers 3

prepare_ppt_folderFunction · 0.45
do_inductFunction · 0.45
do_generateFunction · 0.45

Calls 1

apply_statsMethod · 0.95

Tested by

no test coverage detected