Added exception handling to ML grid detection
This commit is contained in:
parent
d4ccad8e0a
commit
c1e67b716c
@ -133,7 +133,16 @@ async function gridSizeML(image, candidates) {
|
||||
|
||||
export async function getGridSize(image) {
|
||||
const candidates = dividers(image.width, image.height);
|
||||
let prediction = await gridSizeML(image, candidates);
|
||||
let prediction;
|
||||
|
||||
// Try and use ML grid detection
|
||||
// TODO: Fix possible error on Android
|
||||
try {
|
||||
prediction = await gridSizeML(image, candidates);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
if (!prediction) {
|
||||
prediction = gridSizeHeuristic(image, candidates);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user