Pyhton server integration

This commit is contained in:
2025-09-01 11:00:23 -06:00
parent 25ad465bf4
commit 9ab56dfbfe
9 changed files with 449 additions and 64 deletions

View File

@@ -1,6 +1,7 @@
import type { DetectionConfig, DetectionResult, DetectionMetrics, DetectionMode } from './types';
import { DetectionWorkerManager } from './detection-worker-manager';
import { detectDeviceCapabilities, getRecommendedConfig } from './device-capabilities';
import { skuIdentificationService } from '../sku-identification';
// Extend window interface for TensorFlow.js
declare global {
@@ -150,6 +151,35 @@ export class DetectionEngine {
}
}
/**
* Identify product SKU from detected shoe
* @param videoElement - Video element to capture image from
* @returns Promise<string | null> - Product SKU if identified successfully
*/
async identifyProductSKU(videoElement: HTMLVideoElement): Promise<string | null> {
try {
console.log('🔍 Starting product SKU identification...');
// Capture high-quality image for SKU identification
const imageData = this.captureVideoFrame(videoElement, true);
// Call SKU identification service
const sku = await skuIdentificationService.identifySKU(imageData);
if (sku) {
console.log('✅ Product SKU identified:', sku);
} else {
console.log('❌ No valid SKU found');
}
return sku;
} catch (error) {
console.error('❌ SKU identification failed:', error);
return null;
}
}
/**
* Continuous detection loop
*/