Skip to content

Commit 966fb8a

Browse files
committed
1.8
1 parent c7b7785 commit 966fb8a

28 files changed

+185
-34
lines changed

1024.png

50.6 KB
Loading

180.png

5.09 KB
Loading

192.png

5.48 KB
Loading

512.png

16.1 KB
Loading

app/1024.png

50.6 KB
Loading

app/180.png

5.09 KB
Loading

app/192.png

5.48 KB
Loading

app/512.png

16.1 KB
Loading

app/actions.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import {
4444
checkUpdateStatus,
4545
markUpdateComplete,
4646
updateTagName,
47+
getTrainingRecordCount,
4748
} from "@/lib/db";
4849
import {
4950
getNotificationPlates as getNotificationPlatesDB,
@@ -1102,6 +1103,9 @@ export async function skipImageMigration() {
11021103

11031104
export async function generateTrainingData() {
11041105
try {
1106+
const config = await getConfig();
1107+
1108+
console.log("Starting training data generation and upload process");
11051109
const tmpDir = path.join(os.tmpdir(), "alpr-training-" + Date.now());
11061110
const generator = new TrainingDataGenerator(tmpDir);
11071111
await generator.generateAndUpload();
@@ -1117,3 +1121,31 @@ export async function generateTrainingData() {
11171121
throw new Error(error.message || "Failed to generate training data");
11181122
}
11191123
}
1124+
1125+
export async function processTrainingData() {
1126+
try {
1127+
// Check if training is enabled in settings
1128+
const config = await getConfig();
1129+
if (!config?.training?.enabled) {
1130+
return { success: false, message: "Training not enabled" };
1131+
}
1132+
1133+
// Check if we have enough records
1134+
const { newRecordsCount } = await getTrainingRecordCount();
1135+
if (newRecordsCount < 500) {
1136+
return { success: false, message: "Not enough new records" };
1137+
}
1138+
1139+
// Create temp directory
1140+
const tempDir = path.join(os.tmpdir(), `alpr-training-${Date.now()}`);
1141+
1142+
// Start the generator
1143+
const generator = new TrainingDataGenerator(tempDir);
1144+
await generator.generateAndUpload();
1145+
1146+
return { success: true };
1147+
} catch (error) {
1148+
console.error("Error processing training data:", error);
1149+
return { success: false, error: error.message };
1150+
}
1151+
}

app/apple-icon.png

5.09 KB
Loading

0 commit comments

Comments
 (0)