jbilcke-hf/ai-comic-factory
11k
1export type ProjectionMode = 'cartesian' | 'spherical'2 3export type CacheMode = "use" | "renew" | "ignore"4 5export interface RenderRequest {6 prompt: string7 8 // whether to use video segmentation9 // disabled (default)10 // firstframe: we only analyze the first frame11 // allframes: we analyze all the frames12 segmentation: 'disabled' | 'firstframe' | 'allframes'13 14 // segmentation will only be executed if we have a non-empty list of actionnables15 // actionnables are names of things like "chest", "key", "tree", "chair" etc16 actionnables: string[]17 18 nbFrames: number19 nbFPS: number20 21 nbSteps: number // min: 1, max: 5022 23 seed: number24 25 width: number // fixed at 1024 for now26 height: number // fixed at 512 for now27 28 // upscaling factor29 // 0: no upscaling30 // 1: no upscaling31 // 2: 2x larger32 // 3: 3x larger33 // 4x: 4x larger, up to 4096x4096 (warning: a PNG of this size can be 50 Mb!)34 upscalingFactor: number35 36 projection: ProjectionMode37 38 /**39 * Use turbo mode40 * 41 * At the time of writing this will use SSD-1B + LCM42 * https://huggingface.co/spaces/jbilcke-hf/fast-image-server43 */44 turbo: boolean45 46 cache: CacheMode47 48 wait: boolean // wait until the job is completed49 50 analyze: boolean // analyze the image to generate a caption (optional)51 52 identityImage: string // reference image for the main entity53}54 55export interface ImageSegment {56 id: number57 box: number[]58 color: number[]59 label: string60 score: number 61}62 63export type RenderedSceneStatus =64 | "pregenerated"65 | "pending"66 | "completed"67 | "error"68 69export interface RenderedScene {70 renderId: string71 status: RenderedSceneStatus72 assetUrl: string 73 alt: string74 error: string75 maskUrl: string76 segments: ImageSegment[]77}78 79export interface ImageAnalysisRequest {80 image: string // in base6481 prompt: string82}83 84export interface ImageAnalysisResponse {85 result: string86 error?: string87}88 89export type GeneratedPanel = {90 panel: number91 instructions: string92 speech: string93 caption: string94}95 96export type GeneratedPanels = GeneratedPanel[]97 98// LLMVendor = what the user configure in the UI (eg. a dropdown item called default server)99// LLMEngine = the actual engine to use (eg. hugging face)100export type LLMEngine =101 | "INFERENCE_API"102 | "INFERENCE_ENDPOINT"103 | "OPENAI"104 | "REPLICATE"105 | "GROQ"106 | "ANTHROPIC"107 108export type RenderingEngine =109 | "VIDEOCHAIN"110 | "OPENAI"111 | "REPLICATE"112 | "INFERENCE_API"113 | "INFERENCE_ENDPOINT"114 115export type RenderingModelVendor =116 | "SERVER"117 | "OPENAI"118 | "REPLICATE"119 | "HUGGINGFACE"120 121// LLMVendor = what the user configure in the UI (eg. a dropdown item called default server)122// LLMEngine = the actual engine to use (eg. hugging face)123export type LLMVendor =124 | "SERVER"125 | "OPENAI"126 | "GROQ"127 | "ANTHROPIC"128 129export type LLMVendorConfig = {130 vendor: LLMVendor131 apiKey: string132 modelId: string133}134 135export type LLMPredictionFunctionParams = {136 systemPrompt: string137 userPrompt: string138 nbMaxNewTokens: number139 llmVendorConfig: LLMVendorConfig140}141 142export type PostVisibility =143 | "featured" // featured by admins144 | "trending" // top trending / received more than 10 upvotes145 | "normal" // default visibility146 147export type Post = {148 postId: string149 appId: string150 prompt: string151 previewUrl: string152 assetUrl: string153 createdAt: string154 visibility: PostVisibility155 upvotes: number156 downvotes: number157}158 159export type CreatePostResponse = {160 success?: boolean161 error?: string162 post: Post163}164 165export type GetAppPostsResponse = {166 success?: boolean167 error?: string168 posts: Post[]169}170 171export type GetAppPostResponse = {172 success?: boolean173 error?: string174 post: Post175}176 177export type LayoutProps = {178 page: number179 nbPanels: number180}181 182// TODO: rename the *Model fields to better indicate if this is a LLM or RENDER mdoel183export type Settings = {184 renderingModelVendor: RenderingModelVendor185 renderingUseTurbo: boolean186 llmVendor: LLMVendor187 huggingFaceOAuth: string188 huggingfaceApiKey: string189 huggingfaceInferenceApiModel: string190 huggingfaceInferenceApiModelTrigger: string191 huggingfaceInferenceApiFileType: string192 replicateApiKey: string193 replicateApiModel: string194 replicateApiModelVersion: string195 replicateApiModelTrigger: string196 openaiApiKey: string197 openaiApiModel: string198 openaiApiLanguageModel: string199 groqApiKey: string200 groqApiLanguageModel: string201 anthropicApiKey: string202 anthropicApiLanguageModel: string203 hasGeneratedAtLeastOnce: boolean204 userDefinedMaxNumberOfPages: number205}206 207export type DynamicConfig = {208 maxNbPages: number209 nbPanelsPerPage: number210 nbTotalPanelsToGenerate: number211 oauthClientId: string212 oauthRedirectUrl: string213 oauthScopes: string214 enableHuggingFaceOAuth: boolean215 enableHuggingFaceOAuthWall: boolean216}217 