-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
*
: add multi-version node test matrix (#22)
* `*`: add multi-version node tests * `*`: use `example.mjs` * `*`: use `blob.arrayBuffer()` instead of `FileReader` * `.github/workflows/validate.yml`: use latest deno version
- Loading branch information
1 parent
b0a7943
commit 8f768bd
Showing
4 changed files
with
58 additions
and
8 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,32 @@ | ||
import { createProdia } from "./dist/v2/index.js"; | ||
import { strictEqual } from "assert"; | ||
|
||
const token = process.env.PRODIA_TOKEN; | ||
|
||
if (typeof token !== "string") { | ||
throw new Error("PRODIA_TOKEN is not set"); | ||
} | ||
|
||
const isJpeg = (image) => { | ||
const view = new Uint8Array(image); | ||
|
||
return view[0] === 0xff && view[1] === 0xd8; | ||
}; | ||
|
||
const client = createProdia({ | ||
token, | ||
}); | ||
|
||
const job = await client.job({ | ||
type: "inference.flux.dev.txt2img.v1", | ||
config: { | ||
prompt: "puppies in a cloud, 4k", | ||
steps: 1, | ||
width: 1024, | ||
height: 1024, | ||
}, | ||
}); | ||
|
||
const image = await job.arrayBuffer(); | ||
|
||
strictEqual(isJpeg(image), true, "Image should be a JPEG"); |
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 |
---|---|---|
|
@@ -28,6 +28,9 @@ | |
}, | ||
"author": "Monty Anderson <[email protected]>", | ||
"license": "ISC", | ||
"engines": { | ||
"node": ">=18.0.0" | ||
}, | ||
"devDependencies": { | ||
"prettier": "^3.0.0", | ||
"typescript": "^5.1.6" | ||
|
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