async fn main() {
let graphSeshVecFS = match init_multi_tf_graph(tfModelsFSPaths) {
Ok(graphSeshVal) => graphSeshVal,
Err(initErrMsg) => panic!(
"Error while loading/initializing Food Scoring graphs: {}",
initErrMsg
),
};
let graphSeshVecFC = match init_multi_tf_graph(tfModelsFCPath) {
Ok(graphSeshVal) => graphSeshVal,
Err(initErrMsg) => panic!(
"Error while loading/initializing Food Classification graphs: {}",
initErrMsg
),
};
info!("Models loaded into memory...");
loop {
//---------------------------------------- polling and downloading from s3----------------
let poll_result = tokio::spawn(async move {polling_downloading(foodImgsFolder.clone(), awsRegion.clone(), sqsQueueName, s3BucketB2)});
//-----------------------------------------------------------------------------------------
let currentImgCount = getFileCountInDirectory(&configInfo.localFiles_FoodImagesDirectory.clone()).unwrap();
info!(
"Current Image count in FoodImages directory: {}",
currentImgCount
);
// if currentImgCount > 0 {
let inference_result = task::spawn_blocking(move || {
runModelInferenceAndStoreResult(foodImgsFolder.clone(),redisConnStr.clone(),&graphSeshVecFC,&graphSeshVecFS,currentImgCount);});
tokio::join!(poll_result,inference_result );
info!(
"Image rating flow completed execution in: {:?}",
imgRatingFlowTimeStart.elapsed()
);
}
}