runonweb 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,57 @@
1
+ export type BonsaiLoadProgress = {
2
+ phase?: string
3
+ component?: string
4
+ loaded?: number
5
+ total?: number
6
+ fromCache?: boolean
7
+ inFlight?: boolean
8
+ }
9
+
10
+ export type BonsaiGenerateOptions = {
11
+ prompt: string
12
+ width?: number
13
+ height?: number
14
+ numInferenceSteps?: number
15
+ seed?: number
16
+ signal?: AbortSignal
17
+ callbackOnStepEnd?: (
18
+ pipeline: unknown,
19
+ step: number,
20
+ timestep: number,
21
+ extras: { latents: unknown }
22
+ ) => void | Promise<void>
23
+ }
24
+
25
+ export type BonsaiLoadOptions = {
26
+ onProgress?: (status: BonsaiLoadProgress) => void
27
+ cache?: boolean
28
+ cacheName?: string
29
+ force?: boolean
30
+ signal?: AbortSignal
31
+ fetch?: typeof fetch
32
+ repoId?: string
33
+ revision?: string
34
+ }
35
+
36
+ export class BonsaiImageResult {
37
+ bytes: Uint8Array
38
+ width: number
39
+ height: number
40
+ prompt: string
41
+ seed: number
42
+ toBlob(): Blob
43
+ toDataURL(): Promise<string>
44
+ toImageBitmap(): Promise<ImageBitmap>
45
+ }
46
+
47
+ export class BonsaiImagePipeline {
48
+ static isSupported(): Promise<boolean>
49
+ static from_pretrained(
50
+ modelId?: string | null,
51
+ options?: BonsaiLoadOptions
52
+ ): Promise<BonsaiImagePipeline>
53
+ static clearCache(cacheName?: string | null): Promise<void>
54
+ generate(options: BonsaiGenerateOptions): Promise<BonsaiImageResult>
55
+ destroy(): Promise<void>
56
+ getModelName(): string
57
+ }