-
Notifications
You must be signed in to change notification settings - Fork 844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I annotate/caption the image and display it when exporting it to markdown or text file? #256
Comments
@sunwoongc If I understand you correctly, you want to add a caption to the figure. In general, this would be done in this way, fig_caption = doc.add_text(
label=DocItemLabel.CAPTION, text=("".join(texts)).strip()
)
doc.add_picture(
parent=self.parents[self.level],
caption=fig_caption,
) You can also inspect the backends, eg here Let me know if this helps you (and if so, feel free to close the issue). |
I think this request is similar to what we are planning in #192. |
Thanks for the kind and quick reply! I'm not quite sure how to use handle_figure just yet, but I'll give it a try. Thanks! What I'm actually aiming to do is convert an image into descriptive text that represents the image’s content. When exporting the result to markdown using .export_to_markdown(), I notice that the image is represented by a placeholder tag, By the way, I found that in the export_to_document_tokens method of PictureItem, there's a section of code that adds a caption to the body.
However, I haven't found a way to initialize |
my proposal to you would be to make a class that inherits the DoclingDocument and write a custom export which is similar to export_to_markdown and adapts this section |
Thanks I'll try it. |
@sunwoongc We believe this is addressed by #192. In order to avoid duplicate issues, we will close this one and move to #192. Feel free to keep an eye on it. |
Question
I want to add a captions to the
PictureItem
and display it on the markdown or text instead of image itself or image placeholder.In this case, should I add an annotation for each
PictureItem
as below:or should I implement a custom
BaseEnrichmentModel
or custom class inherited fromImageRef
?I think I can develop some mode for ImageRefMode like
ImageRefMode.LLM
The text was updated successfully, but these errors were encountered: