Skip to content

Commit 4a404ee

Browse files
authored
Merge pull request #38 from 851996006/main
add "useragent"
2 parents 3842c80 + 0111f42 commit 4a404ee

6 files changed

+17
-6
lines changed

SampleCode/Python/sample_figure_understanding.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,9 @@
327327
"\n",
328328
" \"\"\"\n",
329329
" document_intelligence_client = DocumentIntelligenceClient(\n",
330-
" endpoint=doc_intelligence_endpoint, credential=AzureKeyCredential(doc_intelligence_key)\n",
330+
" endpoint=doc_intelligence_endpoint, \n",
331+
" credential=AzureKeyCredential(doc_intelligence_key),\n",
332+
" headers={\"x-ms-useragent\":\"sample-code-figure-understanding/1.0.0\"},\n",
331333
" )\n",
332334
"\n",
333335
" with open(input_file_path, \"rb\") as f:\n",

SampleCode/Python/sample_identify_and_merge_cross_page_tables.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,9 @@
388388
" None\n",
389389
" \"\"\"\n",
390390
" document_intelligence_client = DocumentIntelligenceClient(\n",
391-
" endpoint=endpoint, credential=AzureKeyCredential(key)\n",
391+
" endpoint=endpoint, \n",
392+
" credential=AzureKeyCredential(key),\n",
393+
" headers={\"x-ms-useragent\":\"sample-code-merge-cross-tables/1.0.0\"},\n",
392394
" )\n",
393395
"\n",
394396
" file_path = \"<The path to your file>\"\n",

SampleCode/Python/sample_identify_and_merge_cross_page_tables.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,9 @@ def identify_and_merge_cross_page_tables(input_file_path):
324324
None
325325
"""
326326
document_intelligence_client = DocumentIntelligenceClient(
327-
endpoint=endpoint, credential=AzureKeyCredential(key)
327+
endpoint=endpoint,
328+
credential=AzureKeyCredential(key),
329+
headers={"x-ms-useragent":"sample-code-merge-cross-tables/1.0.0"},
328330
)
329331

330332
file_path = input_file_path

SampleCode/Python/sample_identify_cross_page_tables.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@
195195
" None\n",
196196
" \"\"\"\n",
197197
" document_intelligence_client = DocumentIntelligenceClient(\n",
198-
" endpoint=endpoint, credential=AzureKeyCredential(key)\n",
198+
" endpoint=endpoint, \n",
199+
" credential=AzureKeyCredential(key),\n",
200+
" headers={\"x-ms-useragent\":\"sample-code-identify-cross-tables/1.0.0\"},\n",
199201
" )\n",
200202
"\n",
201203
" file_path = \"<The path to your file>\"\n",

SampleCode/Python/sample_identify_cross_page_tables.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ def identify_cross_page_tables(input_file_path):
153153
None
154154
"""
155155
document_intelligence_client = DocumentIntelligenceClient(
156-
endpoint=endpoint, credential=AzureKeyCredential(key)
156+
endpoint=endpoint,
157+
credential=AzureKeyCredential(key),
158+
headers={"x-ms-useragent":"sample-code-identify-cross-tables/1.0.0"},
157159
)
158160

159161
file_path = input_file_path

SampleCode/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ The Layout model provides various building blocks like tables, paragraphs, secti
2323
| File Name | Description |
2424
| --- | --- |
2525
| [sample_rag_langchain.ipynb](Python/sample_rag_langchain.ipynb) | Sample RAG notebook using Azure AI Document Intelligence as document loader, MarkdownHeaderSplitter and Azure AI Search as retriever in Langchain |
26+
| [sample_identify_and_merge_cross_page_tables.ipynb](Python/sample_identify_and_merge_cross_page_tables.ipynb) and [sample_identify_and_merge_cross_page_tables.py](Python/sample_identify_and_merge_cross_page_tables.py) | Sample postprocessing script to identify and merge cross-page tables based on business rules. |
2627
| [sample_figure_understanding.ipynb](Python/sample_figure_understanding.ipynb) | Sample notebook showcasing how to crop the figures and send figure content (with its caption) to Azure Open AI GPT-4V model to understand the semantics. The figure description will be used to update the markdown output, which can be further used for [semantic chunking](https://aka.ms/doc-gen-ai). |
2728

2829

30+
2931
# Pre/post processing samples
3032
There are usually some pre/post processing steps that are needed to get the best results from the Document Intelligence models. These steps are not part of the Document Intelligence service, but are common steps that are needed to get the best results. The following samples show how to do these steps.
3133

3234
| File Name | Description |
3335
| --- | --- |
3436
| [sample_disambiguate_similar_characters.ipynb](Python/sample_disambiguate_similar_characters.ipynb) and [sample_disambiguate_similar_characters.py](Python/sample_disambiguate_similar_characters.py) | Sample postprocessing script to disambiguate similar characters based on business rules. |
3537
| [sample_identify_cross_page_tables.ipynb](Python/sample_identify_cross_page_tables.ipynb) and [sample_identify_cross_page_tables.py](Python/sample_identify_cross_page_tables.py) | Sample postprocessing script to identify cross-page tables based on business rules. |
36-
| [sample_identify_and_merge_cross_page_tables.ipynb](Python/sample_identify_and_merge_cross_page_tables.ipynb) and [sample_identify_and_merge_cross_page_tables.py](Python/sample_identify_and_merge_cross_page_tables.py) | Sample postprocessing script to identify and merge cross-page tables based on business rules. |

0 commit comments

Comments
 (0)