PyVisionLab / types.ts
Choup's picture
Upload 16 files
8d8a5e1 verified
Raw History Blame Contribute Delete
2.56 kB
export enum NodeType {
SOURCE = 'SOURCE',
PROCESS = 'PROCESS',
AI = 'AI',
UTILITY = 'UTILITY',
OUTPUT = 'OUTPUT',
CUSTOM = 'CUSTOM'
}
export type Language = 'en' | 'fr';
export interface NodeDefinition {
id: string;
name: string;
name_fr?: string;
type: NodeType;
description: string;
description_fr?: string;
category: 'input' | 'transform' | 'ai' | 'utility' | 'output' | 'custom' | 'logic';
library: 'Core' | 'OpenCV' | 'MediaPipe' | 'Custom' | 'Community' | 'Connectivity' | 'GenAI' | 'Logic';
pythonClass: string;
pythonTemplate: string;
requiredImports?: string[];
inputs: number;
outputs: number;
}
export interface Position {
x: number;
y: number;
}
export interface ApiConfig {
url: string;
method: 'GET' | 'POST' | 'PUT';
headers: { id: string; key: string; value: string; isSecret: boolean }[];
timeout: number;
sendImage: boolean;
imageResizeWidth?: number;
asyncMode: boolean;
}
export interface DroidCamConfig {
ip: string;
port: string;
}
export interface OnnxConfig {
modelPath: string;
}
export interface LogicConfig {
inputKey?: string;
inputKeyA?: string;
inputKeyB?: string;
index?: number;
operation?: 'add' | 'sub' | 'mul' | 'div' | 'dist';
comparator?: '>' | '<' | '==' | '!=';
threshold?: number;
outputKey: string;
triggerKey?: string;
}
export interface PipelineNode {
uuid: string;
defId: string;
position: Position;
params: {
apiConfig?: ApiConfig;
droidCam?: DroidCamConfig;
onnx?: OnnxConfig;
logic?: LogicConfig;
[key: string]: any;
};
}
export interface PipelineConnection {
id: string;
sourceNodeId: string;
targetNodeId: string;
}
export interface Challenge {
id: string;
title: string;
title_fr?: string;
difficulty: 'Easy' | 'Medium' | 'Hard' | 'Custom';
theme: 'Basic' | 'Tracking' | 'Segmentation' | 'Optimization' | 'Creative' | 'Community';
description: string;
description_fr?: string;
objectives: string[];
objectives_fr?: string[];
locked: boolean;
isUserCreated?: boolean;
isCompleted?: boolean;
completionDate?: string | null;
}
export interface OptimizerConfig {
resolutionScale: number;
frameSkip: number;
useThreading: boolean;
enableCuda: boolean;
}
export interface ValidationResult {
success: boolean;
message: string;
hint?: string;
}
export interface CppTranspilationResult {
cppCode: string;
cmakeCode: string;
explanation: string;
}
export type ViewState = 'STUDIO' | 'CHALLENGES' | 'EDITOR' | 'CHALLENGE_WORKSPACE' | 'CORRECTOR';