Skip to content

Commit 3a3dde6

Browse files
enkr1onno-vos-dev
authored andcommitted
✨ [examples] Added for s3 textract
1 parent 780504c commit 3a3dde6

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

examples/textract.ex

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
defmodule AWS.Examples.Textract do
2+
3+
@doc"""
4+
Examples of analyzing a document.
5+
REF: https://docs.aws.amazon.com/textract/latest/dg/text-location.html
6+
"""
7+
def analyze_document do
8+
case AWS.Client.create("ACCESS_KEY", "SECRET_KEY", "REGION")
9+
|> AWS.Textract.analyze_document(%{
10+
"Document" => %{
11+
"Bytes" =>
12+
"/folder/file"
13+
|> File.read!()
14+
|> Base.encode64()
15+
},
16+
"FeatureTypes" => ["TABLES"]
17+
}) do
18+
{
19+
:ok,
20+
%{
21+
"AnalyzeDocumentModelVersion" => _,
22+
"Blocks" => blocks,
23+
"DocumentMetadata" => _
24+
} = _results,
25+
_response
26+
} ->
27+
# Process the results
28+
nil
29+
30+
error ->
31+
error
32+
end
33+
end
34+
end

0 commit comments

Comments
 (0)