Save topic images.
(model, path: str)
| 407 | |
| 408 | |
| 409 | def 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 | |
| 424 | def save_topics(model, path: str): |