fixed fetch bug
This commit is contained in:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user