-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
121 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { BlobServiceClient } from "@azure/storage-blob" | ||
import { DefaultAzureCredential } from "@azure/identity" | ||
|
||
script({ | ||
parameters: { | ||
account: { | ||
description: "Azure Storage Account Name", | ||
default: "myaccount", | ||
type: "string", | ||
}, | ||
container: { | ||
description: "Azure Storage Container Name", | ||
default: "mycontainer", | ||
type: "string", | ||
}, | ||
}, | ||
}) | ||
|
||
const { account, container } = env.vars | ||
const blobServiceClient = new BlobServiceClient( | ||
`https://${account}.blob.core.windows.net`, | ||
new DefaultAzureCredential() | ||
) | ||
const containerClient = blobServiceClient.getContainerClient(container) | ||
for await (const blob of containerClient.listBlobsFlat()) { | ||
const blockBlobClient = containerClient.getBlockBlobClient(blob.name) | ||
const downloadBlockBlobResponse = await blockBlobClient.download(0) | ||
const body = await downloadBlockBlobResponse.readableStreamBody | ||
const buffer = await body.read() | ||
const res = await runPrompt((_) => { | ||
_.defImages(buffer) | ||
_.$`Describe the image.` | ||
}) | ||
// do something with res? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters