From 4c38140661e58f7cf1babbc31113a146195018f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20Krau=C3=9Fer?= Date: Thu, 30 Apr 2026 20:04:41 +0200 Subject: [PATCH] changes website design --- cnn_website/src/Bird_CNN.css | 115 +++++++++++++++++++++-------------- cnn_website/src/Bird_CNN.jsx | 95 +++++++++++++++++++---------- 2 files changed, 133 insertions(+), 77 deletions(-) diff --git a/cnn_website/src/Bird_CNN.css b/cnn_website/src/Bird_CNN.css index e7c8b23..89ec9f0 100644 --- a/cnn_website/src/Bird_CNN.css +++ b/cnn_website/src/Bird_CNN.css @@ -1,39 +1,5 @@ -#background { - position: absolute; - left: 0; - top: 0; - background-image: url('/cherry_bird.jpeg'); - background-size: cover; - background-position: center; - height: 100vh; - width: 100%; - z-index: 0; - opacity: 0.1; - pointer-events: none; -} - -.site-content { - display: flex; - flex-direction: column; - align-items: center; - position: relative; - z-index: 1; - margin-top: 120px; - height: 600px; -} - -.content-block { - display: flex; - align-items: baseline; - gap: 20px; -} - -.input-box { - display: flex; - gap: 20px; -} - .custom-button { + height: 40px; padding: 10px 20px; background: #333; color: rgb(225, 225, 225); @@ -47,29 +13,90 @@ color: white; } -.response-block { - margin-top: auto; - width: 20%; +.custom-button.inactive { + background: #333; + color: rgb(117, 117, 117); + cursor: default; +} + +.custom-button.inactive:hover { + border-color: black; +} + +.explanation-box a, +span, +p { + line-height: 1.7; + font-size: 17px; +} + +a { + color: rgb(0, 0, 0); + text-decoration: none; + border-bottom: 1px solid black; + padding-bottom: 2px; + transition: border-color 0.15s; +} + +a:hover { + border-color: white; +} + + +.explanation-box { + flex: 1; + min-width: 0; display: flex; flex-direction: column; - justify-content: left; + flex-wrap: wrap; + overflow: hidden; + border: 3px solid rgb(48, 62, 74); + margin: 50px; + padding: 50px; + border-radius: 12px; + background: rgb(97, 125, 151); } .image-box { - border: 1px solid black; + border: 2px solid black; background: rgb(69, 69, 69); - height: 300px; - width: 500px; + height: 400px; + width: 600px; margin-top: 40px; display: flex; align-items: center; justify-content: center; border-radius: 8px; - opacity: 0.5; + background: rgba(0, 0, 0, 0.5); + cursor: pointer; +} + +.image-box:hover { + border-color: white; +} + +.image-box img { + border: 2px solid black; + border-Radius: 8px; + +} + +.image-box:hover p { + color: white; +} + +.image-box img:hover { + border-color: white; } .image-box.active { - opacity: 1; background: none; border: none; +} + +.content-block { + display: flex; + align-items: center; + gap: 20px; + height: 40px; } \ No newline at end of file diff --git a/cnn_website/src/Bird_CNN.jsx b/cnn_website/src/Bird_CNN.jsx index d536fc3..46825df 100644 --- a/cnn_website/src/Bird_CNN.jsx +++ b/cnn_website/src/Bird_CNN.jsx @@ -1,6 +1,6 @@ import { useState } from 'react' import { useRef } from "react"; -import './Bird_CNN.css' +import './Bird_CNN.css'; function Bird_CNN() { const apiUrl = process.env.NODE_ENV === "development" @@ -14,6 +14,12 @@ function Bird_CNN() { const [confidence, setConfidence] = useState(null); const [error, setError] = useState(false); const [preview, setPreview] = useState(null); + const fileInputRef = useRef(null); + const uploadButton = useRef(null); + + const handleImageDivClick = () => { + fileInputRef.current.click(); + } const handleImage = (e) => { setFile(e.target.files[0]); @@ -21,6 +27,7 @@ function Bird_CNN() { if (e.target.files[0]) { setPreview(URL.createObjectURL(e.target.files[0])); boxRef.current.classList.add("active"); + uploadButton.current.classList.remove("inactive"); } setConfidence(null); setBirdClass(null); @@ -57,42 +64,64 @@ function Bird_CNN() { return ( <> -
-
-

Bird Species Expert

-
- - -
-
- {preview && ( - preview - )} -
+
+ +
+ {!preview &&

Select Image

} + {preview && ( + preview + )} +
-
- {!error &&
-

Bird Species:

-

{birdClass}

-
} - {!error &&
-

Model Confidence:

-

{confidence}

-
} - {error &&

An Error has uccured. Please try again later.

} +
+
+

Bird Species:

+

{birdClass}

+
+
+

Model Confidence:

+

{confidence}

+
+ {error &&

An Error has uccured. Please try again later.

} +
+
+ +
+

Model Architecture

+
+ The model used for classification is a convolutional neural network (CNN) based on depthwise separable convolutions, as introduced in the + Xception: Deep Learning with Depthwise Separable Convolutions + paper by François Chollet. It uses who knows how many layers, a dropout and multiple batchnormalsation. +
+