-
Notifications
You must be signed in to change notification settings - Fork 1
/
Program.cs
34 lines (25 loc) · 1.19 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// took from https://docs.microsoft.com/en-us/azure/applied-ai-services/form-recognizer/quickstarts/try-v3-csharp-sdk
using Microsoft.Extensions.Configuration;
public class Program
{
public static async Task Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.Build();
var formRecognizerOptions = config
.GetRequiredSection("FormRecognizer")
.Get<FormRecognizerOptions>();
var storageOptions = config
.GetRequiredSection("Storage")
.Get<StorageOptions>();
var filePath = "sample-layout.pdf";
var documentStore = new DocumentStore(storageOptions);
var filename = await documentStore.Store(filePath);
var storageUrl = $"https://{storageOptions.AccountName}.blob.{storageOptions.EndpointSuffix}";
Console.WriteLine($"Stored document: {storageUrl}/{storageOptions.ContainerName}/{filename}");
var readUrl = documentStore.GetAccessUrl(filename);
Console.WriteLine($"SAS Read Url: {readUrl}");
await new PrebuiltModels(formRecognizerOptions).Analyze(readUrl);
}
}