fixed fetch bug

This commit is contained in:
2026-05-04 23:59:17 +02:00
parent 8339ef8a35
commit ad5acf85f9
+7 -7
View File
@@ -61,13 +61,6 @@ function Bird_CNN() {
method: "POST",
body: formData,
});
} catch (e) {
setError(true);
return;
}
finally {
setLoading(false);
}
if (!response.ok) {
setError(true);
@@ -78,9 +71,16 @@ function Bird_CNN() {
}
const result = await response.json();
setBirdClass(result["class"]);
const confidence = result["confidence"];
setConfidence(`${Math.round(confidence * 100)}%`);
} catch (e) {
setError(true);
}
finally {
setLoading(false);
}
};
return (