fixed fetch bug
This commit is contained in:
@@ -61,13 +61,6 @@ function Bird_CNN() {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData,
|
body: formData,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
setError(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
setLoading(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
setError(true);
|
setError(true);
|
||||||
@@ -78,9 +71,16 @@ function Bird_CNN() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
|
|
||||||
setBirdClass(result["class"]);
|
setBirdClass(result["class"]);
|
||||||
const confidence = result["confidence"];
|
const confidence = result["confidence"];
|
||||||
setConfidence(`${Math.round(confidence * 100)}%`);
|
setConfidence(`${Math.round(confidence * 100)}%`);
|
||||||
|
} catch (e) {
|
||||||
|
setError(true);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user