ce7cb702218693d08ea6d83464d2457c9250027c
This commit is contained in:
commit
34c5f8963c
1 changed files with 145336 additions and 0 deletions
35
services/frigate/run.fsx
Normal file
35
services/frigate/run.fsx
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#r "/opt/fsi/packages/AWSSDK.Core.dll"
|
||||
#r "/opt/fsi/packages/AWSSDK.S3.dll"
|
||||
#load "model.fsx"
|
||||
|
||||
open System.IO
|
||||
open System.Text.Json
|
||||
open Amazon.Runtime
|
||||
open Amazon.S3
|
||||
open Amazon.S3.Model
|
||||
|
||||
[<CLIMutable>]
|
||||
type Settings =
|
||||
{ Endpoint: string
|
||||
Bucket: string
|
||||
Key: string
|
||||
Sha256: string
|
||||
Destination: string }
|
||||
|
||||
let settings =
|
||||
JsonSerializer.Deserialize<Settings>(File.ReadAllText "/installer/settings.json")
|
||||
|
||||
let download (output: Stream) =
|
||||
let accessKey = File.ReadAllText("/s3/accessKeyId").TrimEnd()
|
||||
let secretKey = File.ReadAllText("/s3/secretAccessKey").TrimEnd()
|
||||
|
||||
let config =
|
||||
AmazonS3Config(ServiceURL = settings.Endpoint, AuthenticationRegion = "us-east-1", ForcePathStyle = true)
|
||||
|
||||
use client = new AmazonS3Client(BasicAWSCredentials(accessKey, secretKey), config)
|
||||
let request = GetObjectRequest(BucketName = settings.Bucket, Key = settings.Key)
|
||||
use reply = client.GetObjectAsync(request).GetAwaiter().GetResult()
|
||||
reply.ResponseStream.CopyTo output
|
||||
|
||||
let outcome = Model.install settings.Sha256 settings.Destination download
|
||||
printfn "Model %A sha256:%s" outcome settings.Sha256
|
||||
Loading…
Reference in a new issue