MCPcopy
hub / github.com/MaartenGr/BERTopic / save_images

Function save_images

bertopic/_save_utils.py:409–421  ·  view source on GitHub ↗

Save topic images.

(model, path: str)

Source from the content-addressed store, hash-verified

407
408
409def save_images(model, path: str):
410 """Save topic images."""
411 if _has_vision:
412 visual_aspects = None
413 for aspect, value in model.topic_aspects_.items():
414 if isinstance(value[0], Image.Image):
415 visual_aspects = model.topic_aspects_[aspect]
416 break
417
418 if visual_aspects is not None:
419 path.mkdir(exist_ok=True, parents=True)
420 for topic, image in visual_aspects.items():
421 image.save(path / f"{topic}.jpg")
422
423
424def save_topics(model, path: str):

Callers

nothing calls this directly

Calls 1

saveMethod · 0.80

Tested by

no test coverage detected