UNPKG

@aivue/image-caption

Version:

AI-powered image captioning for Vue.js applications using Hugging Face BLIP models

123 lines (122 loc) 2.99 kB
export interface ImageCaptionConfig { apiKey?: string; model?: string; maxLength?: number; minLength?: number; temperature?: number; topK?: number; topP?: number; repetitionPenalty?: number; useCache?: boolean; waitForModel?: boolean; } export interface ImageCaptionOptions { model?: string; prompt?: string; detail?: 'low' | 'high' | 'auto'; maxTokens?: number; temperature?: number; } export interface ImageCaptionResult { caption: string; confidence?: number; model: string; processingTime: number; timestamp: Date; } export interface ImageCaptionError { message: string; code?: string; status?: number; details?: any; timestamp?: Date; } export interface ImageUploadEvent { file: File; dataUrl: string; size: number; type: string; name: string; timestamp?: Date; } export interface CaptionHistory { id: string; image: string; caption: string; model: string; timestamp: Date; processingTime: number; confidence?: number; } export interface ImageCaptionState { isLoading: boolean; isProcessing: boolean; error: string | null; result: ImageCaptionResult | null; history: CaptionHistory[]; currentImage: string | null; } export interface HuggingFaceResponse { generated_text?: string; error?: string; estimated_time?: number; } export interface ModelInfo { id: string; name: string; description: string; provider: 'huggingface'; type: 'image-to-text'; maxImageSize?: number; supportedFormats?: string[]; } export interface ImageProcessingOptions { maxWidth?: number; maxHeight?: number; quality?: number; format?: 'jpeg' | 'png' | 'webp'; resize?: boolean; } export interface CaptionGenerationOptions { includeConfidence?: boolean; includeAlternatives?: boolean; maxAlternatives?: number; filterProfanity?: boolean; customPrompt?: string; } export interface BatchCaptionRequest { images: (File | string)[]; options?: ImageCaptionOptions; } export interface BatchCaptionResult { results: ImageCaptionResult[]; errors: Array<{ index: number; error: ImageCaptionError; }>; totalProcessed: number; totalProcessingTime?: number; processingTime: number; successCount: number; errorCount: number; } export interface ImageCaptionAnalytics { totalCaptions: number; averageProcessingTime: number; mostUsedModel: string; successRate: number; errorRate: number; topImageTypes: Array<{ type: string; count: number; }>; dailyUsage: Array<{ date: string; count: number; }>; } export declare const AVAILABLE_MODELS: ModelInfo[]; export declare const DEFAULT_CONFIG: ImageCaptionConfig; export declare const SUPPORTED_IMAGE_TYPES: string[]; export declare const MAX_IMAGE_SIZE: number; export declare const MAX_BATCH_SIZE = 10;