changed cnn architecture
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<link rel="icon" type="image/svg+xml" href="/generated_two_no_background.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>cnn_website</title>
|
||||
<title>Birdy</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB |
@@ -4,8 +4,8 @@ import './Bird_CNN.css';
|
||||
|
||||
function Bird_CNN() {
|
||||
const apiUrl = process.env.NODE_ENV === "development"
|
||||
? "https://api.marvinkrausser.com"
|
||||
: "https://api.marvinkrausser.com";
|
||||
? "https://marvinkrausser.com/api"
|
||||
: "https://marvinkrausser.com/api";
|
||||
|
||||
const [file, setFile] = useState(null);
|
||||
const [birdClass, setBirdClass] = useState(null);
|
||||
@@ -54,30 +54,33 @@ function Bird_CNN() {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
|
||||
setLoading(true);
|
||||
|
||||
try {
|
||||
setLoading(true);
|
||||
const response = await fetch(`${apiUrl}/predict`, {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
setError(true);
|
||||
return;
|
||||
}
|
||||
finally {
|
||||
setLoading(false);
|
||||
|
||||
if (!response.ok) {
|
||||
setError(true);
|
||||
}
|
||||
else {
|
||||
setError(false);
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
setBirdClass(result["class"]);
|
||||
const confidence = result["confidence"];
|
||||
setConfidence(`${Math.round(confidence * 100)}%`);
|
||||
}
|
||||
catch (error) {
|
||||
console.error("Upload failed:", error);
|
||||
|
||||
if (!response.ok) {
|
||||
setError(true);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
setError(false);
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
setBirdClass(result["class"]);
|
||||
const confidence = result["confidence"];
|
||||
setConfidence(`${Math.round(confidence * 100)}%`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user