# Get the Q&A in LayoutLMv2 in text form

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fget-the-q-a-in-layoutlmv2-in-text-form%2F14384%3E%5C
**Category:** Models\
**Created:** [February 3, 2022, 3:59pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fget-the-q-a-in-layoutlmv2-in-text-form%2F14384 "2022-02-03T15:59:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![paramdeep](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@paramdeep](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fparamdeep)%5C
**Post date:** [February 3, 2022, 3:59pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fget-the-q-a-in-layoutlmv2-in-text-form%2F14384%2F1 "2022-02-03T15:59:48Z")

</div>

I am going through the [LayoutLMv2 inference tutorial](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/LayoutLMv2/FUNSD/True_inference_with_LayoutLMv2ForTokenClassification_%2B_Gradio_demo.ipynb) by @nielsr. This is a great tutorial to understand how LayoutLM is working.

The final output of the model is in the form of bounding boxes on top of the invoice image. I would like to get the Question & Answer pair as the output (JSON if possible). My questions are -

1. How can I get the Question and Answer text (instead of the bounding boxes)
2. How do I cluster the words in Questions/ Answer (right now there can be multiple bounding boxes for a single Question/ Answer

Any help in this regard would be appreciated.

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnielsr)%5C
**Post date:** [February 7, 2022, 8:17pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fget-the-q-a-in-layoutlmv2-in-text-form%2F14384%2F2 "2022-02-07T20:17:50Z")

</div>

Hi,

We plan to add LayoutLMv2ForRelationExtraction (that allows you to do just that) to the library. See [here](https://github.com/huggingface/transformers/issues/15451) to follow the progress (it also includes a link to a Colab notebook).
