single OCR thread in //
This commit is contained in:
parent
012b72527b
commit
8f88548a59
@ -248,6 +248,8 @@ const isDragOver = ref(false);
|
|||||||
const error = ref("");
|
const error = ref("");
|
||||||
const files = ref<SubmissionFile[]>([]);
|
const files = ref<SubmissionFile[]>([]);
|
||||||
|
|
||||||
|
const isProcessingOCR = ref(false);
|
||||||
|
|
||||||
// Watch for external changes to modelValue
|
// Watch for external changes to modelValue
|
||||||
watch(
|
watch(
|
||||||
() => props.modelValue,
|
() => props.modelValue,
|
||||||
@ -374,6 +376,12 @@ const isOpusMagnumImage = (file: File): boolean => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const processOCR = async (submissionFile: SubmissionFile) => {
|
const processOCR = async (submissionFile: SubmissionFile) => {
|
||||||
|
while (isProcessingOCR.value) {
|
||||||
|
console.log("OCR is already processing, waiting 500ms...");
|
||||||
|
await new Promise((res) => setTimeout(res, 500));
|
||||||
|
}
|
||||||
|
|
||||||
|
isProcessingOCR.value = true;
|
||||||
// Find the file in the reactive array to ensure proper reactivity
|
// Find the file in the reactive array to ensure proper reactivity
|
||||||
const fileIndex = files.value.findIndex(
|
const fileIndex = files.value.findIndex(
|
||||||
(f) => f.file === submissionFile.file,
|
(f) => f.file === submissionFile.file,
|
||||||
@ -412,6 +420,7 @@ const processOCR = async (submissionFile: SubmissionFile) => {
|
|||||||
} finally {
|
} finally {
|
||||||
files.value[fileIndex].ocrProcessing = false;
|
files.value[fileIndex].ocrProcessing = false;
|
||||||
}
|
}
|
||||||
|
isProcessingOCR.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const retryOCR = (submissionFile: SubmissionFile) => {
|
const retryOCR = (submissionFile: SubmissionFile) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user