diff --git a/.gitattributes b/.gitattributes index a6344aac8c09253b3b630fb776ae94478aa0275b..d35c4a86738c5c9b50eda073385e60d5f415897e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -33,3 +33,14 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text *tfevents* filter=lfs diff=lfs merge=lfs -text +frontend/static/images/neurons.gif filter=lfs diff=lfs merge=lfs -text +models/bird/static/images/bg1.jpg filter=lfs diff=lfs merge=lfs -text +models/bird/static/images/bg2.jpg filter=lfs diff=lfs merge=lfs -text +models/bird/static/images/bg3.jpg filter=lfs diff=lfs merge=lfs -text +models/chess/static/images/bg1.jpg filter=lfs diff=lfs merge=lfs -text +models/chess/static/images/bg2.jpg filter=lfs diff=lfs merge=lfs -text +models/mammals/static/images/forest[[:space:]]image.jpg filter=lfs diff=lfs merge=lfs -text +models/sports_ball/static/images/bg10.gif filter=lfs diff=lfs merge=lfs -text +models/weather/static/images/bg.jpg filter=lfs diff=lfs merge=lfs -text +models/weather/static/images/bg2.jpg filter=lfs diff=lfs merge=lfs -text +models/weather/static/images/weather_bg.gif filter=lfs diff=lfs merge=lfs -text diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..b6108974b26fc12249f3fd9cae06f67a9adc8948 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# Use the official Python 3.9 image +FROM python:3.9 + +# Set the working directory to /code +WORKDIR /code + +# Copy the current directory contents into the container at /code +COPY ./requirements.txt /code/requirements.txt + +# Install requirements.txt +RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt + +# Set up a new user named "user" with user ID 1000 +RUN useradd -m -u 1000 user +# Switch to the "user" user +USER user +# Set home to the user's home directory +ENV HOME=/home/user \ + PATH=/home/user/.local/bin:$PATH + +# Set the working directory to the user's home directory +WORKDIR $HOME/app + +# Copy the current directory contents into the container at $HOME/app setting the owner to the user +COPY --chown=user . $HOME/app + +CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"] diff --git a/frontend/main.html b/frontend/main.html new file mode 100644 index 0000000000000000000000000000000000000000..afeebe5b17084c3735f578f9795befbab3dd0f72 --- /dev/null +++ b/frontend/main.html @@ -0,0 +1,73 @@ + + + + + + Deep Learning Models + + + + + + +
+

Deep Learning Models

+ +
+
+

Flower Classification🌼

+

This model classifies different types of flowers in images.

+ Use this model +
+ +
+

Mammals Classification🦁

+

This model classifies images into different mammal categories..

+ Use this model +
+ +
+

Cards Classification♠

+

This model identifies Cards realted to the images.

+ Use this model +
+ +
+

Weather Classification

+

This model predicts the weather.

+ Use this model +
+ +
+

Yoga Pose Prediction

+

This model predicts the yoga pose in images related to the yoga position

+ Use this model +
+ +
+

Indian Bird Prediction

+

This model Classify the Indian Birds

+ Use this model +
+ +
+

Dog Breed Prediction🐕

+

This model predicts your dog's breed

+ Use this model +
+ +
+

Chess Pieces Prediction

+

This model Predict Your Chess Piece

+ Use this model +
+ +
+

Sports ball Prediction⚽

+

This model classifies different types of sports ball

+ Use this model +
+
+
+ + diff --git a/frontend/static/images/neurons.gif b/frontend/static/images/neurons.gif new file mode 100644 index 0000000000000000000000000000000000000000..aa45c68fc0e38fa11836a7d76405ff2cccae0657 --- /dev/null +++ b/frontend/static/images/neurons.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:265e8542f574f173f0ed0d46dd154b77f841056f0d5a72fe8ced925d0dde8cff +size 2137217 diff --git a/frontend/static/main.css b/frontend/static/main.css new file mode 100644 index 0000000000000000000000000000000000000000..49067d43e404d8f5a7d75bba67ad343e037c121f --- /dev/null +++ b/frontend/static/main.css @@ -0,0 +1,125 @@ +/* main.css */ +body { + font-family: "Libre Baskerville", serif; + font-weight: 400; + font-style: italic; + margin: 0; + padding: 0; + background: url('images/neurons.gif') no-repeat center center fixed; + background-size: cover; + background-attachment: fixed; +} + +.container { + max-width: 600px; + margin: 10px auto; + background-color: rgba(0, 0, 0, 0.3); /* Add a semi-transparent white background on top of the GIF */ + padding: 20px; + text-align: center; + border-radius: 8px; + box-shadow: 0 0 10px rgba(15, 166, 185, 0.897); +} + +h1 { + color: #ffffff; + font-family: "Caprasimo", serif; + font-weight: 400; + font-style: normal; +} + +.model-list { + display: flex; + flex-wrap: wrap; + justify-content: center; +} + +.model { + width: 100%; + margin-bottom: 30px; + padding: 25px; + border: px solid #c71919; + border-radius: 5px; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); + + backdrop-filter: blur(20px); +} + +h2 { + color: #2bb1b6; + font-weight: bold; + font-family: "Bungee", sans-serif; +} + +p { + color: #f3f3f3; + font-family: "Young Serif", serif; + +} + +a { + display: block; + margin-top: 10px; + padding: 8px; + background-color: #22b4ad; + color: #fff; + text-align: center; + text-decoration: none; + border-radius: 5px; + font-family: "Caprasimo", serif; + font-weight: 400; + font-style: normal; + transition: background-color 0.3s; +} + +a:hover { + background-color: #009eb3; + letter-spacing: 3px; +} + +a:active { + background-color: #009eb3; + letter-spacing: 2px; + box-shadow: #009eb3 0px 7px 29px 0px; + transform: translateY(10px); +} +a:focus { + outline: none; +} + + +/* Media Query for smaller screens */ +@media only screen and (max-width: 600px) { + .model { + width: 100%; + } + h1{ + font-size:25px; + } + + .container { + max-width: 400px; + margin: 10px auto; + padding: 10px; + text-align: center; + } + + h2{ + font-size:20px + } + + p{ + font-size:13px + } + + .container { + max-width: 100%; + margin: 5px auto; + padding: 20px; + text-align: center; + border-radius: 8px; + } + + body { + background-size: cover; /* or 'contain' based on your preference */ + } +} diff --git a/models/bird/bird.html b/models/bird/bird.html new file mode 100644 index 0000000000000000000000000000000000000000..9d715b93964d2b55e953b4eaf87a66661f1b46b7 --- /dev/null +++ b/models/bird/bird.html @@ -0,0 +1,39 @@ + + + + + + + + + + + Bird Classification + + +
+

Bird Classification

+
+
+
+ + +
+
+ +
+
+ +
+ + + + + + \ No newline at end of file diff --git a/models/bird/bird_modelV2.h5 b/models/bird/bird_modelV2.h5 new file mode 100644 index 0000000000000000000000000000000000000000..700b07174e60f49cb1475060bdc7e331f8e14de3 --- /dev/null +++ b/models/bird/bird_modelV2.h5 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe542ffd79ac5af88daa17361a3fc49a8120c9dece7fe5e62732f54e7cf5eb41 +size 12552432 diff --git a/models/bird/static/bird.css b/models/bird/static/bird.css new file mode 100644 index 0000000000000000000000000000000000000000..8ca5dc70d03514028bbda60c7b0707bebac2d727 --- /dev/null +++ b/models/bird/static/bird.css @@ -0,0 +1,193 @@ +/* style.css */ + +body, html { + margin: 0; + padding: 0; + height: 100%; +} + +body { + background-image: url('images/bg4.jpg'); + background-size: cover; + background-position: center; + background-repeat: no-repeat; + font-family: 'Arial', sans-serif; + color: #333; + overflow-y: scroll; + background-attachment: fixed; +} + +.container { + max-width: 600px; /* Adjust the max-width as needed */ + margin: 20px auto; + padding: 20px; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); + backdrop-filter: blur(0px); +} + +.header-container { + max-width: 600px; + margin: 0 auto; + background-color: ##f4d03f;/* Adjust the alpha value for transparency */ + border-radius: 8px; + padding: 20px; + border: 1px solid ##3498db; + border-radius: 10px; + text-align: center; + margin-bottom: 20px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 6); + backdrop-filter: blur(0px); + margin: 20px auto 0 +} + + +h1 { + text-align: center; + color: rgb(255, 255, 255); + font-weight: bold; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 8); + margin: 0; +} + + +#fileInputContainer { + position: relative; + margin-bottom: 20px; + + +} + +#fileInput { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + opacity: 0; + cursor: pointer; + backdrop-filter: blur(0px); + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); +} + +#fileInputLabel { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: 18px; + color: #ffd903; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 2); + font-weight: bold; + cursor: pointer; + transition: color 0.3s ease; +} + +#fileInputLabel:hover { + color: #297fb8; +} + +#imagePreview { + max-width: 100%; + height: auto; + border: 0px solid #ddd; + border-radius: 8px; + padding: 10px; + backdrop-filter: blur(50px); + margin-bottom: 20px; + display: block; + margin: 0 auto; +} +#imageContainer { + text-align: center; + backdrop-filter: blur(10px); /* Adjust the blur value as needed */ + + border-radius: 8px; + padding: 10px; + margin-bottom: 20px; + display: block; + margin: 0 auto; +} + +.upload-icon { + font-size: 36px; + margin-bottom: 10px; +} + +.predict-btn { + width: 100%; + padding: 10px; + background-color:rgb(159, 172, 41); + color:white; + font-weight: bold; + border: none; + border-radius: 50px; + cursor: pointer; + transition: background-color 0.3s; +} + +.predict-btn:hover { + background-color: #0c8b30; + letter-spacing: 2px; + box-shadow: #0c8b30 0px 7px 29px 0px; +} + +.predict-btn:active { + background-color: #0c8b30; + letter-spacing: 2px; + box-shadow: #0c8b30 0px 7px 29px 0px; + transform: translateY(10px); +} +.predict-btn:focus { + outline: none; +} + +#predictionResult { + color: white; /* Change the color to white */ + margin-top: 20px; + text-align: center; + backdrop-filter: blur(0px); + font-weight: bold; + border: none; + box-shadow: none; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 2); + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9) + box-shadow: none; +} + +@media only screen and (max-width: 600px) { + h1{ + font-size:25px; + font-family: 'Kanit', sans-serif; + } + #imagePreview { + max-width: 70%; + height: 60%; + border: 0px solid #ddd; + border-radius: 8px; + padding: 10px; + backdrop-filter: blur(50px); + margin-bottom: 10px; + display: block; + margin: 0 auto; +} + body { + background-size: fixed; /* or 'contain' based on your preference */ + } +} + +.loading-icon { + display: none; + border: 4px solid #f3f3f3; + border-top: 4px solid #3498db; + border-radius: 50%; + width: 20px; + height: 20px; + animation: spin 1s linear infinite; +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} \ No newline at end of file diff --git a/models/bird/static/bird.js b/models/bird/static/bird.js new file mode 100644 index 0000000000000000000000000000000000000000..ad255c36aee0e0e5c0ca09ea90a56c6a884b55d3 --- /dev/null +++ b/models/bird/static/bird.js @@ -0,0 +1,68 @@ +document.addEventListener("DOMContentLoaded", function () { + const form = document.getElementById("uploadForm"); + const fileInput = document.getElementById("fileInput"); + const predictButton = document.getElementById("predictButton"); + const loadingIcon = document.getElementById("loadingIcon"); + + form.addEventListener("submit", function (event) { + event.preventDefault(); + + // Show loading icon and change button text + loadingIcon.style.display = "inline-block"; + predictButton.innerHTML = ' Predicting...'; + + const formData = new FormData(form); + fetch("/predict_bird", { + method: "POST", + body: formData, + }) + .then(response => response.json()) + .then(data => { + // Hide loading icon and reset button text + loadingIcon.style.display = "none"; + predictButton.innerHTML = 'Predict'; + + displayPredictionResult(data); + }) + .catch(error => { + // Hide loading icon in case of error and reset button text + loadingIcon.style.display = "none"; + predictButton.innerHTML = 'Predict'; + + console.error("Error:", error); + }); + }); + + // Image preview on file input change + fileInput.addEventListener("change", function () { + const file = fileInput.files[0]; + if (file) { + displayImagePreview(file); + } + }); +}); + +function displayPredictionResult(data) { + const resultDiv = document.getElementById("predictionResult"); + if (data.confidence < 75) { + alert("Please upload a valid or clear image."); + } else { + resultDiv.innerHTML = ` +

Predicted: ${data.class}

+

Confidence: ${data.confidence}%

+ `; + } +} + +function displayImagePreview(file) { + const imagePreview = document.getElementById("imagePreview"); + const imagePreviewContainer = document.getElementById("imagePreviewContainer"); + + const reader = new FileReader(); + reader.onload = function (e) { + imagePreview.src = e.target.result; + }; + + reader.readAsDataURL(file); + imagePreviewContainer.style.display = "block"; +} diff --git a/models/bird/static/images/bg1.jpg b/models/bird/static/images/bg1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..fc4c97ecee780d73b5b34d246f6177978db03cfe --- /dev/null +++ b/models/bird/static/images/bg1.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:89bb7d106c8cf3314e5e27f1b37695179e230c87359ef1df2c018c014363ca37 +size 1449087 diff --git a/models/bird/static/images/bg2.jpg b/models/bird/static/images/bg2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5c839c89d1f45e9505baf9e007687127cbcb5662 --- /dev/null +++ b/models/bird/static/images/bg2.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af041dbd9473fd3bbbcc52898682793bb232d8bc71fca1c59bfaf738a8f99364 +size 4423425 diff --git a/models/bird/static/images/bg3.jpg b/models/bird/static/images/bg3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..72546bca0b39dd0794347de5ff7c9272799aa40c --- /dev/null +++ b/models/bird/static/images/bg3.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b441bf87a7c0d506b24164e8a233b02c603ecb6bff42bf81d5388a15e941a9f1 +size 1077158 diff --git a/models/bird/static/images/bg4.jpg b/models/bird/static/images/bg4.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4b0598aee32f2bb428d4266a20ac2fe222701558 Binary files /dev/null and b/models/bird/static/images/bg4.jpg differ diff --git a/models/card/card.html b/models/card/card.html new file mode 100644 index 0000000000000000000000000000000000000000..c89c7903be875b71eae41fbedd2372bc0209bb1f --- /dev/null +++ b/models/card/card.html @@ -0,0 +1,39 @@ + + + + + + + + + + + Cards Prediction + + +
+

Cards Prediction

+
+
+
+ + +
+
+ +
+
+ +
+ + + + + + \ No newline at end of file diff --git a/models/card/card_model_v2.h5 b/models/card/card_model_v2.h5 new file mode 100644 index 0000000000000000000000000000000000000000..5d9935f14a4794461e2398bdd698bf23f521ee4f --- /dev/null +++ b/models/card/card_model_v2.h5 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ba7901ceb009883b4698b0e99aa1970a7d8360086b978a87fe9ed703d959979 +size 9781296 diff --git a/models/card/static/card.css b/models/card/static/card.css new file mode 100644 index 0000000000000000000000000000000000000000..1d087017c39bd6fff8bfdbf88e9a9cb946ec4d0e --- /dev/null +++ b/models/card/static/card.css @@ -0,0 +1,197 @@ +/* style.css */ + +body, html { + margin: 0; + padding: 0; + height: 100%; +} + +body { + background-image: url('images/bg2.jpg'); + background-size: cover; + background-position: center; + background-repeat: no-repeat; + font-family: 'Arial', sans-serif; + color: #333; + overflow-y: scroll; + background-attachment: fixed; +} + +.container { + max-width: 600px; /* Adjust the max-width as needed */ + margin: 20px auto; + padding: 20px; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); + backdrop-filter: blur(0px); +} + +.header-container { + max-width: 600px; + margin: 0 auto; + background-color: #000000;/* Adjust the alpha value for transparency */ + border-radius: 8px; + padding: 20px; + border: 1px solid hsl(0, 0%, 100%); + border-radius: 10px; + text-align: center; + margin-bottom: 20px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 6); + backdrop-filter: blur(30px); + margin: 20px auto 0; +} + + +h1 { + text-align: center; + color: rgb(255, 5, 5); + font-weight: bold; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 20); + margin: 0; + font-family: 'Kanit', sans-serif; +} + + +#fileInputContainer { + position: relative; + margin-bottom: 20px; + border: 1px solid ##3498db; + +} + +#fileInput { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + opacity: 0; + cursor: pointer; + backdrop-filter: blur(0px); + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); +} + +#fileInputLabel { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: 18px; + color: #ff0000; + font-family: 'Kanit', sans-serif; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9); + font-weight: bold; + cursor: pointer; + transition: color 0.3s ease; +} + +#fileInputLabel:hover { + color: #297fb8; +} + +#imagePreview { + max-width: 50%; + max-height: 10%; + border: 0px solid #ddd; + border-radius: 8px; + padding: 10px; + backdrop-filter: blur(50px); + margin-bottom: 20px; + display: block; + margin: 0 auto; +} + +#imageContainer { + text-align: center; + backdrop-filter: blur(10px); /* Adjust the blur value as needed */ + background-color: rgba(0, 0, 0, 0.5); /* Adjust the alpha value for transparency */ + border-radius: 8px; + padding: 10px; + margin-bottom: 20px; + display: block; + margin: 0 auto; +} + +.upload-icon { + font-size: 36px; + margin-bottom: 10px; +} + +.predict-btn { + width: 100%; + padding: 10px; + background-color:rgb(36, 3, 21); + color:white; + font-weight: bold; + border: none; + font-family: 'Kanit', sans-serif; + border-radius: 50px; + cursor: pointer; + transition: background-color 0.3s; +} + +.predict-btn:hover { + background-color: #ff0000; + letter-spacing: 2px; + box-shadow: #ff0000 0px 7px 29px 0px; +} + +.predict-btn:active { + background-color: #ff0000; + letter-spacing: 2px; + box-shadow: #ff0000 0px 7px 29px 0px; + transform: translateY(10px); +} +.predict-btn:focus { + outline: none; +} + +#predictionResult { + color: white; /* Change the color to white */ + margin-top: 20px; + text-align: center; + backdrop-filter: blur(40px); + font-weight: bold; + border: none; + font-size: 20px; + font-family: 'Kanit', sans-serif; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9); + box-shadow: none; +} + +@media only screen and (max-width: 600px) { + h1{ + font-size:25px; + font-family: 'Kanit', sans-serif; + } + #imagePreview { + max-width: 70%; + height: 60%; + border: 0px solid #ddd; + border-radius: 8px; + padding: 10px; + backdrop-filter: blur(50px); + margin-bottom: 10px; + display: block; + margin: 0 auto; +} + body { + background-size: cover; /* or 'contain' based on your preference */ + } +} + +.loading-icon { + display: none; + border: 4px solid #f3f3f3; + border-top: 4px solid #3498db; + border-radius: 50%; + width: 20px; + height: 20px; + animation: spin 1s linear infinite; +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} \ No newline at end of file diff --git a/models/card/static/card.js b/models/card/static/card.js new file mode 100644 index 0000000000000000000000000000000000000000..d030c7228863397b067529616538d35c86a8b2c2 --- /dev/null +++ b/models/card/static/card.js @@ -0,0 +1,69 @@ +document.addEventListener("DOMContentLoaded", function () { + const form = document.getElementById("uploadForm"); + const fileInput = document.getElementById("fileInput"); + const imagePreview = document.getElementById("imagePreview"); + const predictButton = document.getElementById("predictButton"); + const loadingIcon = document.getElementById("loadingIcon"); + + form.addEventListener("submit", function (event) { + event.preventDefault(); + + // Show loading icon and change button text + loadingIcon.style.display = "inline-block"; + predictButton.innerHTML = ' Predicting...'; + + const formData = new FormData(form); + fetch("/predict_card", { + method: "POST", + body: formData, + }) + .then(response => response.json()) + .then(data => { + // Hide loading icon and reset button text + loadingIcon.style.display = "none"; + predictButton.innerHTML = 'Predict'; + + displayPredictionResult(data); + }) + .catch(error => { + // Hide loading icon in case of error and reset button text + loadingIcon.style.display = "none"; + predictButton.innerHTML = 'Predict'; + + console.error("Error:", error); + }); + }); + + // Image preview on file input change + fileInput.addEventListener("change", function () { + const file = fileInput.files[0]; + if (file) { + displayImagePreview(file); + } + }); +}); + +function displayPredictionResult(data) { + const resultDiv = document.getElementById("predictionResult"); + if (data.confidence < 75) { + alert("Please upload a valid or clear image."); + } else { + resultDiv.innerHTML = ` +

Predicted: ${data.class}

+

Confidence: ${data.confidence}%

+ `; + } +} + +function displayImagePreview(file) { + const imagePreview = document.getElementById("imagePreview"); + const imagePreviewContainer = document.getElementById("imagePreviewContainer"); + + const reader = new FileReader(); + reader.onload = function (e) { + imagePreview.src = e.target.result; + }; + + reader.readAsDataURL(file); + imagePreviewContainer.style.display = "block"; +} diff --git a/models/card/static/images/bg1.webp b/models/card/static/images/bg1.webp new file mode 100644 index 0000000000000000000000000000000000000000..1a5a3ce7822dd33f5b236811dd928f568b2f4327 Binary files /dev/null and b/models/card/static/images/bg1.webp differ diff --git a/models/card/static/images/bg2.jpg b/models/card/static/images/bg2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e6ff713c424b8c997dad721b6fd20a72e7b93f81 Binary files /dev/null and b/models/card/static/images/bg2.jpg differ diff --git a/models/chess/chess.html b/models/chess/chess.html new file mode 100644 index 0000000000000000000000000000000000000000..553fb8983ae15f9e10adaa78b35675a0ffa4820b --- /dev/null +++ b/models/chess/chess.html @@ -0,0 +1,39 @@ + + + + + + + + + + + Chess Pieces Detection + + +
+

Chess Pieces Detection

+
+
+
+ + +
+
+ +
+
+ +
+ + + + + + \ No newline at end of file diff --git a/models/chess/chess_prediction_v4.h5 b/models/chess/chess_prediction_v4.h5 new file mode 100644 index 0000000000000000000000000000000000000000..48f625661eb2078d46fcd8770c422a97a15a0ad9 --- /dev/null +++ b/models/chess/chess_prediction_v4.h5 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68f9536e37e91ea627b6d220c5889770590c54c0b5b69f5b9ce7b21253a6f619 +size 10037240 diff --git a/models/chess/static/chess.css b/models/chess/static/chess.css new file mode 100644 index 0000000000000000000000000000000000000000..59f6132a0271d02bb66003ac3ecd957da42f99ef --- /dev/null +++ b/models/chess/static/chess.css @@ -0,0 +1,193 @@ +/* style.css */ + +body, html { + margin: 0; + padding: 0; + height: 100%; +} + +body { + background-image: url('images/bg1.jpg'); + background-size: cover; + background-position: center; + background-repeat: no-repeat; + font-family: 'Arial', sans-serif; + color: #333; + overflow-y: scroll; + background-attachment: fixed; +} + +.container { + max-width: 600px; /* Adjust the max-width as needed */ + margin: 20px auto; + padding: 20px; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); + backdrop-filter: blur(0px); +} + +.header-container { + max-width: 600px; + margin: 0 auto; + background-color: ##f4d03f;/* Adjust the alpha value for transparency */ + border-radius: 8px; + padding: 20px; + border: 1px solid ##3498db; + border-radius: 10px; + text-align: center; + margin-bottom: 20px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 6); + backdrop-filter: blur(0px); + margin: 20px auto 0 +} + + +h1 { + text-align: center; + color: rgb(255, 255, 255); + font-weight: bold; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 8); + margin: 0; +} + + +#fileInputContainer { + position: relative; + margin-bottom: 20px; + + +} + +#fileInput { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + opacity: 0; + cursor: pointer; + backdrop-filter: blur(0px); + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); +} + +#fileInputLabel { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: 18px; + color: #ffd903; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 2); + font-weight: bold; + cursor: pointer; + transition: color 0.3s ease; +} + +#fileInputLabel:hover { + color: #297fb8; +} + +#imagePreview { + max-width: 100%; + height: auto; + border: 0px solid #ddd; + border-radius: 8px; + padding: 10px; + backdrop-filter: blur(50px); + margin-bottom: 20px; + display: block; + margin: 0 auto; +} +#imageContainer { + text-align: center; + backdrop-filter: blur(10px); /* Adjust the blur value as needed */ + + border-radius: 8px; + padding: 10px; + margin-bottom: 20px; + display: block; + margin: 0 auto; +} + +.upload-icon { + font-size: 36px; + margin-bottom: 10px; +} + +.predict-btn { + width: 100%; + padding: 10px; + background-color:rgb(159, 172, 41); + color:white; + font-weight: bold; + border: none; + border-radius: 50px; + cursor: pointer; + transition: background-color 0.3s; +} + +.predict-btn:hover { + background-color: #0c8b30; + letter-spacing: 2px; + box-shadow: #0c8b30 0px 7px 29px 0px; +} + +.predict-btn:active { + background-color: #0c8b30; + letter-spacing: 2px; + box-shadow: #0c8b30 0px 7px 29px 0px; + transform: translateY(10px); +} +.predict-btn:focus { + outline: none; +} + +#predictionResult { + color: white; /* Change the color to white */ + margin-top: 20px; + text-align: center; + backdrop-filter: blur(0px); + font-weight: bold; + border: none; + box-shadow: none; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 2); + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9) + box-shadow: none; +} + +@media only screen and (max-width: 600px) { + h1{ + font-size:25px; + font-family: 'Kanit', sans-serif; + } + #imagePreview { + max-width: 70%; + height: 60%; + border: 0px solid #ddd; + border-radius: 8px; + padding: 10px; + backdrop-filter: blur(50px); + margin-bottom: 10px; + display: block; + margin: 0 auto; +} + body { + background-size: cover; /* or 'contain' based on your preference */ + } +} + +.loading-icon { + display: none; + border: 4px solid #f3f3f3; + border-top: 4px solid #3498db; + border-radius: 50%; + width: 20px; + height: 20px; + animation: spin 1s linear infinite; +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} \ No newline at end of file diff --git a/models/chess/static/chess.js b/models/chess/static/chess.js new file mode 100644 index 0000000000000000000000000000000000000000..bcff1a85563f67d6e5d4dd53be8f6918664a62ea --- /dev/null +++ b/models/chess/static/chess.js @@ -0,0 +1,68 @@ +document.addEventListener("DOMContentLoaded", function () { + const form = document.getElementById("uploadForm"); + const fileInput = document.getElementById("fileInput"); + const predictButton = document.getElementById("predictButton"); + const loadingIcon = document.getElementById("loadingIcon"); + + form.addEventListener("submit", function (event) { + event.preventDefault(); + + // Show loading icon and change button text + loadingIcon.style.display = "inline-block"; + predictButton.innerHTML = ' Predicting...'; + + const formData = new FormData(form); + fetch("/predict_chess", { + method: "POST", + body: formData, + }) + .then(response => response.json()) + .then(data => { + // Hide loading icon and reset button text + loadingIcon.style.display = "none"; + predictButton.innerHTML = 'Predict'; + + displayPredictionResult(data); + }) + .catch(error => { + // Hide loading icon in case of error and reset button text + loadingIcon.style.display = "none"; + predictButton.innerHTML = 'Predict'; + + console.error("Error:", error); + }); + }); + + // Image preview on file input change + fileInput.addEventListener("change", function () { + const file = fileInput.files[0]; + if (file) { + displayImagePreview(file); + } + }); +}); + +function displayPredictionResult(data) { + const resultDiv = document.getElementById("predictionResult"); + if (data.confidence < 75) { + alert("Please upload a valid or clear image."); + } else { + resultDiv.innerHTML = ` +

Predicted: ${data.class}

+

Confidence: ${data.confidence}%

+ `; + } +} + +function displayImagePreview(file) { + const imagePreview = document.getElementById("imagePreview"); + const imagePreviewContainer = document.getElementById("imagePreviewContainer"); + + const reader = new FileReader(); + reader.onload = function (e) { + imagePreview.src = e.target.result; + }; + + reader.readAsDataURL(file); + imagePreviewContainer.style.display = "block"; +} diff --git a/models/chess/static/images/bg1.jpg b/models/chess/static/images/bg1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0d90ae2b561651bbac73e63785945d7585b32473 --- /dev/null +++ b/models/chess/static/images/bg1.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2229f7d08bf8a3a99fcd0e43befc33e7af3306beef75f032a50de2cf198afefa +size 1013314 diff --git a/models/chess/static/images/bg2.jpg b/models/chess/static/images/bg2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1d7c03a2c7a83fc8f97c3529044493f5bb709c4f --- /dev/null +++ b/models/chess/static/images/bg2.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f39e3ee970cfa0598968b0e0216ee5bc2c32ffef14b0198c4cdcf4b5a3a2179f +size 3136296 diff --git a/models/dog_breed/dog_breed.html b/models/dog_breed/dog_breed.html new file mode 100644 index 0000000000000000000000000000000000000000..ca683b24b958da89059578b5a82d8a06f16fefa1 --- /dev/null +++ b/models/dog_breed/dog_breed.html @@ -0,0 +1,34 @@ + + + + + + + + + Dog Breed Prediction + + +
+

Dog Breed Prediction

+
+
+
+ + +
+
+ +
+ + + + + + \ No newline at end of file diff --git a/models/dog_breed/dog_breedv3.h5 b/models/dog_breed/dog_breedv3.h5 new file mode 100644 index 0000000000000000000000000000000000000000..a663c27bb9cb5ee843f96fec643a9a27e30e30c9 --- /dev/null +++ b/models/dog_breed/dog_breedv3.h5 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e7cfc1bdd19cd80871d5dfb2d0458131538566b8a4e1a4506ef0dd43c90b3d78 +size 12796128 diff --git a/models/dog_breed/static/dog_breed.css b/models/dog_breed/static/dog_breed.css new file mode 100644 index 0000000000000000000000000000000000000000..8249ec5e374badd69dc74c5eaa0f5d4294862aab --- /dev/null +++ b/models/dog_breed/static/dog_breed.css @@ -0,0 +1,191 @@ +/* style.css */ + +body, html { + margin: 0; + padding: 0; + height: 100%; +} + +body { + background-image: url('images/bg2.jpg'); + background-size: cover; + background-position: center; + background-repeat: no-repeat; + font-family: 'Arial', sans-serif; + color: #333; + overflow-y: scroll; + background-attachment: fixed; +} + +.container { + max-width: 600px; /* Adjust the max-width as needed */ + margin: 20px auto; + padding: 20px; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); + backdrop-filter: blur(0px); +} + +.header-container { + max-width: 600px; + margin: 0 auto; + border-radius: 8px; + padding: 20px; + border-radius: 10px; + text-align: center; + margin-bottom: 20px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 6); + backdrop-filter: blur(10px); + margin: 20px auto 0; +} + + +h1 { + text-align: center; + color: rgb(104, 80, 80); + font-weight: bold; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 20); + margin: 0; +} + + +#fileInputContainer { + position: relative; + margin-bottom: 20px; + border: none; + +} + +#fileInput { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + opacity: 0; + cursor: pointer; + backdrop-filter: blur(0px); + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); +} + +#fileInputLabel { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: 18px; + color: #989e2a; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9); + font-weight: bold; + cursor: pointer; + transition: color 0.3s ease; +} + +#fileInputLabel:hover { + color: #297fb8; +} + +#imagePreview { + max-width: 100%; + height: auto; + border: 0px solid #ddd; + border-radius: 8px; + padding: 10px; + backdrop-filter: blur(50px); + margin-bottom: 20px; + display: block; + margin: 0 auto; +} +#imageContainer { + text-align: center; + backdrop-filter: blur(10px); /* Adjust the blur value as needed */ + background-color: rgba(255, 255, 255, 0.5); /* Adjust the alpha value for transparency */ + border-radius: 8px; + padding: 10px; + margin-bottom: 20px; + display: block; + margin: 0 auto; +} + +.upload-icon { + font-size: 36px; + margin-bottom: 10px; +} + +.predict-btn { + width: 100%; + padding: 10px; + background-color:rgb(72, 59, 59); + color:white; + font-weight: bold; + border: none; + border-radius: 50px; + cursor: pointer; + transition: background-color 0.3s; +} + +.predict-btn:hover { + background-color: #000000; + letter-spacing: 2px; + box-shadow: #000000; 0px 7px 29px 0px; +} + +.predict-btn:active { + background-color: #000000; + letter-spacing: 2px; + box-shadow: #000000; 0px 7px 29px 0px; + transform: translateY(10px); +} +.predict-btn:focus { + outline: none; +} + +#predictionResult { + color: white; /* Change the color to white */ + margin-top: 20px; + text-align: center; + backdrop-filter: blur(40px); + font-weight: bold; + border: none; + font-size: 20px; + font-family: 'Kanit', sans-serif; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9); + box-shadow: none; +} + +@media only screen and (max-width: 600px) { + h1{ + font-size:25px; + font-family: 'Kanit', sans-serif; + } + #imagePreview { + max-width: 70%; + height: 60%; + border: 0px solid #ddd; + border-radius: 8px; + padding: 10px; + backdrop-filter: blur(50px); + margin-bottom: 10px; + display: block; + margin: 0 auto; +} + body { + background-size: cover; /* or 'contain' based on your preference */ + } +} + +.loading-icon { + display: none; + border: 4px solid #f3f3f3; + border-top: 4px solid #3498db; + border-radius: 50%; + width: 20px; + height: 20px; + animation: spin 1s linear infinite; +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} \ No newline at end of file diff --git a/models/dog_breed/static/dog_breed.js b/models/dog_breed/static/dog_breed.js new file mode 100644 index 0000000000000000000000000000000000000000..5d6d22186c934da756865e5e9f0b08d51923b633 --- /dev/null +++ b/models/dog_breed/static/dog_breed.js @@ -0,0 +1,70 @@ +document.addEventListener("DOMContentLoaded", function () { + const form = document.getElementById("uploadForm"); + const fileInput = document.getElementById("fileInput"); + const predictButton = document.getElementById("predictButton"); + const loadingIcon = document.getElementById("loadingIcon"); + + form.addEventListener("submit", function (event) { + event.preventDefault(); + + // Show loading icon and change button text + loadingIcon.style.display = "inline-block"; + predictButton.innerHTML = ' Predicting...'; + + const formData = new FormData(form); + fetch("/predict_dog_breed", { + method: "POST", + body: formData, + }) + .then(response => response.json()) + .then(data => { + // Hide loading icon and reset button text + loadingIcon.style.display = "none"; + predictButton.innerHTML = 'Predict'; + + displayPredictionResult(data); + }) + .catch(error => { + // Hide loading icon in case of error and reset button text + loadingIcon.style.display = "none"; + predictButton.innerHTML = 'Predict'; + + console.error("Error:", error); + }); + }); + + // Image preview on file input change + fileInput.addEventListener("change", function () { + const file = fileInput.files[0]; + if (file) { + displayImagePreview(file); + } + }); +}); + +function displayPredictionResult(data) { + const resultDiv = document.getElementById("predictionResult"); + if (data.confidence < 75) { + alert("Please upload a valid or clear image."); + } else { + resultDiv.innerHTML = ` +

Predicted: ${data.class}

+

Confidence: ${data.confidence}%

+ `; + } +} + +function displayImagePreview(file) { + const body = document.body; + + const reader = new FileReader(); + reader.onload = function (e) { + // Set the background image of the body to the dropped image + body.style.backgroundImage = `url(${e.target.result})`; + body.style.backgroundSize = "cover"; + body.style.backgroundPosition = "center"; + body.style.backgroundRepeat = "no-repeat"; + }; + + reader.readAsDataURL(file); +} diff --git a/models/dog_breed/static/images/bg1.jpg b/models/dog_breed/static/images/bg1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..20ae5ae681f25d7e74024ee03ff7dcb1af305cc8 Binary files /dev/null and b/models/dog_breed/static/images/bg1.jpg differ diff --git a/models/dog_breed/static/images/bg2.jpg b/models/dog_breed/static/images/bg2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b8f4e5fbc9aeb9a887019fad9df3651390a65d1d Binary files /dev/null and b/models/dog_breed/static/images/bg2.jpg differ diff --git a/models/flower/flower.html b/models/flower/flower.html new file mode 100644 index 0000000000000000000000000000000000000000..fc07dbbf4a31c78b1e83678b49732b5298f8f172 --- /dev/null +++ b/models/flower/flower.html @@ -0,0 +1,34 @@ + + + + + + + + + Flower Classification + + +
+

Flower Classification

+
+
+
+ + +
+
+ +
+ + + + + + \ No newline at end of file diff --git a/models/flower/flower_prediction.h5 b/models/flower/flower_prediction.h5 new file mode 100644 index 0000000000000000000000000000000000000000..f23a7709340a4b5366fbb3b721234e1766b7aab5 --- /dev/null +++ b/models/flower/flower_prediction.h5 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a8419d99dab25f5d565ecd08045c94baa618017551d86b0827d22d74d44fc42c +size 97987968 diff --git a/models/flower/static/flower.css b/models/flower/static/flower.css new file mode 100644 index 0000000000000000000000000000000000000000..f1b20f407b4cff8ac0b5e0c06684dfa78d0f08c0 --- /dev/null +++ b/models/flower/static/flower.css @@ -0,0 +1,189 @@ +/* style.css */ + +body, html { + margin: 0; + padding: 0; + height: 100%; +} + +body { + background-image: url('images/bg2.jpg'); + background-size: cover; + background-position: center; + background-repeat: no-repeat; + font-family: 'Arial', sans-serif; + color: #333; + overflow-y: scroll; + background-attachment: fixed; +} + +.container { + max-width: 600px; /* Adjust the max-width as needed */ + margin: 20px auto; + padding: 20px; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); + backdrop-filter: blur(0px); +} + +.header-container { + max-width: 600px; + margin: 0 auto; + border-radius: 8px; + padding: 20px; + border-radius: 10px; + text-align: center; + margin-bottom: 20px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); + backdrop-filter: blur(0px); + margin: 20px auto 0 +} + + +h1 { + text-align: center; + color: rgb(176, 37, 181); + font-weight: bold; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6); + margin: 0; +} + + +#fileInputContainer { + position: relative; + margin-bottom: 20px; +} + +#fileInput { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + opacity: 0; + cursor: pointer; + backdrop-filter: blur(0px); + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); +} + +#fileInputLabel { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: 18px; + color: rgb(176, 37, 181); + font-weight: bold; + cursor: pointer; + transition: color 0.3s ease; +} + +#fileInput :hover { + color: #297fb8; + letter-spacing: 2px; + box-shadow: #2c96ba 0px 7px 29px 0px; + outline: none; +} + +#imagePreview { + max-width: 100%; + height: auto; + border: 0px solid #ddd; + border-radius: 8px; + padding: 10px; + border: rgb(0, 0, 0, 0.5); + backdrop-filter: blur(50px); + margin-bottom: 20px; + display: block; + margin: 0 auto; +} +#imageContainer { + text-align: center; + backdrop-filter: blur(10px); /* Adjust the blur value as needed */ + border-radius: 8px; + padding: 10px; + margin-bottom: 20px; + display: block; + margin: 0 auto; +} + +.upload-icon { + font-size: 36px; + margin-bottom: 10px; +} + +.predict-btn { + width: 100%; + padding: 10px; + background-color:rgb(176, 37, 181); + color:white; + font-weight: bold; + border: none; + border-radius: 50px; + cursor: pointer; + transition: background-color 0.2s; +} + +.predict-btn:hover { + background-color: #2c96ba; + letter-spacing: 2px; + box-shadow: #2c96ba 0px 7px 29px 0px; +} + +.predict-btn:active { + background-color: #2c96ba; + letter-spacing: 2px; + box-shadow: #2c96ba 0px 7px 29px 0px; + transform: translateY(10px); +} +.predict-btn:focus { + outline: none; +} + +#predictionResult { + color: black; /* Change the color to white */ + background-color:rgb(234, 240, 239, 0.3); + margin-top: 20px; + text-align: center; + backdrop-filter: blur(0px); + font-weight: bold; + border: none; + box-shadow: none; +} + +@media only screen and (max-width: 600px) { + h1{ + font-size:25px; + font-family: 'Kanit', sans-serif; + } + #imagePreview { + max-width: 70%; + height: 60%; + border: 0px solid #ddd; + border-radius: 8px; + padding: 10px; + backdrop-filter: blur(50px); + margin-bottom: 10px; + display: block; + margin: 0 auto; +} + body { + background-size: cover; /* or 'contain' based on your preference */ + } +} + +.loading-icon { + display: none; + border: 4px solid #f3f3f3; + border-top: 4px solid #3498db; + border-radius: 50%; + width: 20px; + height: 20px; + animation: spin 1s linear infinite; +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} \ No newline at end of file diff --git a/models/flower/static/flower.js b/models/flower/static/flower.js new file mode 100644 index 0000000000000000000000000000000000000000..b6dde2e85d62ac58b6a5bb097301344e2f0d0a39 --- /dev/null +++ b/models/flower/static/flower.js @@ -0,0 +1,70 @@ +document.addEventListener("DOMContentLoaded", function () { + const form = document.getElementById("uploadForm"); + const fileInput = document.getElementById("fileInput"); + const predictButton = document.getElementById("predictButton"); + const loadingIcon = document.getElementById("loadingIcon"); + + form.addEventListener("submit", function (event) { + event.preventDefault(); + + // Show loading icon and change button text + loadingIcon.style.display = "inline-block"; + predictButton.innerHTML = ' Predicting...'; + + const formData = new FormData(form); + fetch("/predict_flower", { + method: "POST", + body: formData, + }) + .then(response => response.json()) + .then(data => { + // Hide loading icon and reset button text + loadingIcon.style.display = "none"; + predictButton.innerHTML = 'Predict'; + + displayPredictionResult(data); + }) + .catch(error => { + // Hide loading icon in case of error and reset button text + loadingIcon.style.display = "none"; + predictButton.innerHTML = 'Predict'; + + console.error("Error:", error); + }); + }); + + // Image preview on file input change + fileInput.addEventListener("change", function () { + const file = fileInput.files[0]; + if (file) { + displayImagePreview(file); + } + }); +}); + +function displayPredictionResult(data) { + const resultDiv = document.getElementById("predictionResult"); + if (data.confidence < 75) { + alert("Please upload a valid or clear image."); + } else { + resultDiv.innerHTML = ` +

Predicted: ${data.class}

+

Confidence: ${data.confidence}%

+ `; + } +} + +function displayImagePreview(file) { + const body = document.body; + + const reader = new FileReader(); + reader.onload = function (e) { + // Set the background image of the body to the dropped image + body.style.backgroundImage = `url(${e.target.result})`; + body.style.backgroundSize = "cover"; + body.style.backgroundPosition = "center"; + body.style.backgroundRepeat = "no-repeat"; + }; + + reader.readAsDataURL(file); +} diff --git a/models/flower/static/images/bg1.jpeg b/models/flower/static/images/bg1.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..d1cc03b94f257462211bdfaa0f151f087e1f0519 Binary files /dev/null and b/models/flower/static/images/bg1.jpeg differ diff --git a/models/flower/static/images/bg2.jpg b/models/flower/static/images/bg2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..db95b2a311a9f27cf270602fd7a0c31b4dba4a03 Binary files /dev/null and b/models/flower/static/images/bg2.jpg differ diff --git a/models/mammals/Mammals_predictionv1.h5 b/models/mammals/Mammals_predictionv1.h5 new file mode 100644 index 0000000000000000000000000000000000000000..2133c1bf50b9353442535a76a95b509a40fe3197 --- /dev/null +++ b/models/mammals/Mammals_predictionv1.h5 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e407122ffe0857b44239f45dd58bf1b92083d77988995e489cc002e60f10450f +size 10137360 diff --git a/models/mammals/mammals.html b/models/mammals/mammals.html new file mode 100644 index 0000000000000000000000000000000000000000..7e165ff9559a65a4025c00c064097679b6ecc357 --- /dev/null +++ b/models/mammals/mammals.html @@ -0,0 +1,39 @@ + + + + + + + + + + + Mammals Classification + + +
+

Mammals Classification

+
+
+
+ + +
+
+ +
+
+ +
+ + + + + + \ No newline at end of file diff --git a/models/mammals/static/images/forest image.jpg b/models/mammals/static/images/forest image.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3a8a7ff3757f17bde88a3f86a76549352f27725b --- /dev/null +++ b/models/mammals/static/images/forest image.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:173d30aabf900472aa001c567721c3d7ddb4da5d38afa01959ff332296da4445 +size 1130844 diff --git a/models/mammals/static/mammals.css b/models/mammals/static/mammals.css new file mode 100644 index 0000000000000000000000000000000000000000..18b0cdedac5563ed883512ca04741b47fb93a9e4 --- /dev/null +++ b/models/mammals/static/mammals.css @@ -0,0 +1,199 @@ +/* style.css */ + +body, html { + margin: 0; + padding: 0; + height: 100%; +} + +body { + background-image: url('images/forest image.jpg'); + background-size: cover; + background-position: center; + background-repeat: no-repeat; + font-family: 'Arial', sans-serif; + color: #333; + overflow-y: scroll; + background-attachment: fixed; +} + +.container { + max-width: 600px; /* Adjust the max-width as needed */ + margin: 20px auto; + padding: 20px; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); + backdrop-filter: blur(0px); +} + +.header-container { + max-width: 600px; + margin: 0 auto; + background-color: ##f4d03f;/* Adjust the alpha value for transparency */ + border-radius: 8px; + padding: 20px; + border: 1px solid ##3498db; + border-radius: 10px; + text-align: center; + margin-bottom: 20px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 6); + backdrop-filter: blur(0px); + margin: 20px auto 0 +} + + +h1 { + text-align: center; + color: rgb(255, 255, 255); + font-weight: bold; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 8); + margin: 0; +} + + +#fileInputContainer { + position: relative; + margin-bottom: 20px; + + +} + +#fileInput { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + opacity: 0; + cursor: pointer; + backdrop-filter: blur(0px); + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); +} + +#fileInputLabel { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: 18px; + color: #ffd903; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 2); + font-weight: bold; + cursor: pointer; + transition: color 0.3s ease; +} + +#fileInputLabel:hover { + color: #297fb8; +} + +#imagePreview { + max-width: 100%; + height: auto; + border: 0px solid #ddd; + border-radius: 8px; + padding: 10px; + backdrop-filter: blur(50px); + margin-bottom: 20px; + display: block; + margin: 0 auto; +} +#imageContainer { + text-align: center; + backdrop-filter: blur(10px); /* Adjust the blur value as needed */ + + border-radius: 8px; + padding: 10px; + margin-bottom: 20px; + display: block; + margin: 0 auto; +} + +.upload-icon { + font-size: 36px; + margin-bottom: 10px; +} + +.predict-btn { + width: 100%; + padding: 10px; + background-color:rgb(159, 172, 41); + color:white; + font-weight: bold; + border: none; + border-radius: 50px; + cursor: pointer; + transition: background-color 0.3s; +} + +.predict-btn:hover { + background-color: #0c8b30; + letter-spacing: 2px; + box-shadow: #0c8b30 0px 7px 29px 0px; +} + +.predict-btn:active { + background-color: #0c8b30; + letter-spacing: 2px; + box-shadow: #0c8b30 0px 7px 29px 0px; + transform: translateY(10px); +} +.predict-btn:focus { + outline: none; +} + +#predictionResult { + color: white; /* Change the color to white */ + margin-top: 20px; + text-align: center; + backdrop-filter: blur(0px); + font-weight: bold; + border: none; + box-shadow: none; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 2); + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9) + box-shadow: none; +} + +@media only screen and (max-width: 600px) { + h1{ + font-size:25px; + font-family: 'Kanit', sans-serif; + } + #imagePreview { + max-width: 70%; + height: 60%; + border: 0px solid #ddd; + border-radius: 8px; + padding: 10px; + backdrop-filter: blur(50px); + margin-bottom: 10px; + display: block; + margin: 0 auto; +} + body { + background-size: cover; /* or 'contain' based on your preference */ + } + + .predict-btn:hover { + background-color: rgb(159, 172, 41); + letter-spacing: normal; + box-shadow: none; + } +} + +.loading-icon { + display: none; + border: 4px solid #f3f3f3; + border-top: 4px solid #3498db; + border-radius: 50%; + width: 20px; + height: 20px; + animation: spin 1s linear infinite; +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} \ No newline at end of file diff --git a/models/mammals/static/mammals.js b/models/mammals/static/mammals.js new file mode 100644 index 0000000000000000000000000000000000000000..3d7e79d9aa786051d2bda8bd7e03879cca5c99c6 --- /dev/null +++ b/models/mammals/static/mammals.js @@ -0,0 +1,69 @@ +document.addEventListener("DOMContentLoaded", function () { + const form = document.getElementById("uploadForm"); + const fileInput = document.getElementById("fileInput"); + const predictButton = document.getElementById("predictButton"); + const loadingIcon = document.getElementById("loadingIcon"); + + form.addEventListener("submit", function (event) { + event.preventDefault(); + + // Show loading icon and change button text + loadingIcon.style.display = "inline-block"; + predictButton.innerHTML = ' Predicting...'; + + const formData = new FormData(form); + fetch("/predict_mammals", { + method: "POST", + body: formData, + }) + .then(response => response.json()) + .then(data => { + // Hide loading icon and reset button text + loadingIcon.style.display = "none"; + predictButton.innerHTML = 'Predict'; + + displayPredictionResult(data); + }) + .catch(error => { + // Hide loading icon in case of error and reset button text + loadingIcon.style.display = "none"; + predictButton.innerHTML = 'Predict'; + + console.error("Error:", error); + }); + }); + + // Image preview on file input change + fileInput.addEventListener("change", function () { + const file = fileInput.files[0]; + if (file) { + displayImagePreview(file); + } + }); +}); + +function displayPredictionResult(data) { + const resultDiv = document.getElementById("predictionResult"); + if (data.confidence < 75) { + alert("Please upload a valid or clear image."); + } else { + resultDiv.innerHTML = ` +

Predicted: ${data.class}

+

Confidence: ${data.confidence}%

+ `; + } +} + +function displayImagePreview(file) { + const imagePreview = document.getElementById("imagePreview"); + const imagePreviewContainer = document.getElementById("imagePreviewContainer"); + + const reader = new FileReader(); + reader.onload = function (e) { + imagePreview.src = e.target.result; + }; + + reader.readAsDataURL(file); + imagePreviewContainer.style.display = "block"; +} + diff --git a/models/sports_ball/Sports_ball_prediction_v2.h5 b/models/sports_ball/Sports_ball_prediction_v2.h5 new file mode 100644 index 0000000000000000000000000000000000000000..8b38a4a703eab1d2285e4a0621a3df9393a6267b --- /dev/null +++ b/models/sports_ball/Sports_ball_prediction_v2.h5 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f07ced279cdbd58e8bd936d31e2ed9d1c0a452223f4d6b5f2852e9d8e207ce5 +size 13239936 diff --git a/models/sports_ball/sports_ball.html b/models/sports_ball/sports_ball.html new file mode 100644 index 0000000000000000000000000000000000000000..38b4ac25405f925c7bf7c2e9847bde1afc548dcc --- /dev/null +++ b/models/sports_ball/sports_ball.html @@ -0,0 +1,39 @@ + + + + + + + + + + + Sports Ball Prediction + + +
+

Sports Ball Prediction

+
+
+
+ + +
+
+ +
+
+ +
+ + + + + + \ No newline at end of file diff --git a/models/sports_ball/static/images/balls.jpg b/models/sports_ball/static/images/balls.jpg new file mode 100644 index 0000000000000000000000000000000000000000..115be872b89a0cb33bd416c8e6c1d9ade8f33ca2 Binary files /dev/null and b/models/sports_ball/static/images/balls.jpg differ diff --git a/models/sports_ball/static/images/bg10.gif b/models/sports_ball/static/images/bg10.gif new file mode 100644 index 0000000000000000000000000000000000000000..f0d6e585e4121b78c4c4516680b203f10a55c501 --- /dev/null +++ b/models/sports_ball/static/images/bg10.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:254e5b97a37c7765f408f557544f7822856ccd98c22137e23750c061a6dbbb1d +size 1801220 diff --git a/models/sports_ball/static/images/ronaldo.gif b/models/sports_ball/static/images/ronaldo.gif new file mode 100644 index 0000000000000000000000000000000000000000..f1ac9c60a6e84d2871a6058ea1ed2350f760d851 Binary files /dev/null and b/models/sports_ball/static/images/ronaldo.gif differ diff --git a/models/sports_ball/static/sports_ball.css b/models/sports_ball/static/sports_ball.css new file mode 100644 index 0000000000000000000000000000000000000000..4ad7f9bacec45d06509645f85821f65b6e5a60c0 --- /dev/null +++ b/models/sports_ball/static/sports_ball.css @@ -0,0 +1,195 @@ +/* style.css */ + +body, html { + margin: 0; + padding: 0; + height: 100%; +} + +body { + background-image: url('images/bg10.gif'); + background-size: cover; + background-position: center; + background-repeat: no-repeat; + font-family: 'Arial', sans-serif; + color: #333; + overflow-y: scroll; + background-attachment: fixed; +} + +.container { + max-width: 600px; /* Adjust the max-width as needed */ + margin: 20px auto; + padding: 20px; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); + backdrop-filter: blur(0px); +} + +.header-container { + max-width: 600px; + margin: 0 auto; + background-color: ##f4d03f;/* Adjust the alpha value for transparency */ + border-radius: 8px; + padding: 20px; + border: 1px solid ##3498db; + border-radius: 10px; + text-align: center; + margin-bottom: 20px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); + backdrop-filter: blur(0px); + margin: 20px auto 0; +} + + +h1 { + text-align: center; + color: rgb(76, 105, 179); + font-weight: bold; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9); + margin: 0; +} + + +#fileInputContainer { + position: relative; + margin-bottom: 20px; + border: 1px solid ##3498db; + +} + +#fileInput { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + opacity: 0; + cursor: pointer; + backdrop-filter: blur(0px); + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); +} + +#fileInputLabel { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: 18px; + color: #ebe045; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9); + font-weight: bold; + cursor: pointer; + transition: color 0.3s ease; +} + +#fileInputLabel:hover { + color: #297fb8; +} + +#imagePreview { + max-width: 100%; + height: auto; + border: 0px solid #ddd; + border-radius: 8px; + padding: 10px; + backdrop-filter: blur(50px); + margin-bottom: 20px; + display: block; + margin: 0 auto; +} +#imageContainer { + text-align: center; + backdrop-filter: blur(10px); /* Adjust the blur value as needed */ + background-color: rgba(255, 255, 255, 0.5); /* Adjust the alpha value for transparency */ + border-radius: 8px; + padding: 10px; + margin-bottom: 20px; + display: block; + margin: 0 auto; +} + +.upload-icon { + font-size: 36px; + margin-bottom: 10px; +} + +.predict-btn { + width: 100%; + padding: 10px; + background-color:rgb(51, 95, 207); + color:white; + font-weight: bold; + border: none; + border-radius: 50px; + cursor: pointer; + transition: background-color 0.3s; +} + +.predict-btn:hover { + background-color: #33aa3d; + letter-spacing: 2px; + box-shadow: #297fb8 0px 7px 29px 0px; +} + +.predict-btn:active { + background-color: #297fb8; + letter-spacing: 2px; + box-shadow: #297fb8 0px 7px 29px 0px; + transform: translateY(10px); +} +.predict-btn:focus { + outline: none; +} +.predict-btn:after { + background-color:rgb(51, 95, 207); +} + +#predictionResult { + color: black; /* Change the color to white */ + margin-top: 20px; + text-align: center; + backdrop-filter: blur(0px); + font-weight: bold; + border: none; + box-shadow: none; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9) + box-shadow: none; +} + +@media only screen and (max-width: 600px) { + h1{ + font-size:25px; + font-family: 'Kanit', sans-serif; + } + #imagePreview { + max-width: 70%; + height: 60%; + border: 0px solid #ddd; + border-radius: 8px; + padding: 10px; + backdrop-filter: blur(50px); + margin-bottom: 10px; + display: block; + margin: 0 auto; +} + body { + background-size: cover; /* or 'contain' based on your preference */ + } +} + +.loading-icon { + display: none; + border: 4px solid #f3f3f3; + border-top: 4px solid #3498db; + border-radius: 50%; + width: 20px; + height: 20px; + animation: spin 1s linear infinite; +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} \ No newline at end of file diff --git a/models/sports_ball/static/sports_ball.js b/models/sports_ball/static/sports_ball.js new file mode 100644 index 0000000000000000000000000000000000000000..f24c4768afc9c01ab2dc1c35e2a8c76c2de24737 --- /dev/null +++ b/models/sports_ball/static/sports_ball.js @@ -0,0 +1,69 @@ +document.addEventListener("DOMContentLoaded", function () { + const form = document.getElementById("uploadForm"); + const fileInput = document.getElementById("fileInput"); + const imagePreview = document.getElementById("imagePreview"); + const predictButton = document.getElementById("predictButton"); + const loadingIcon = document.getElementById("loadingIcon"); + + form.addEventListener("submit", function (event) { + event.preventDefault(); + + // Show loading icon and change button text + loadingIcon.style.display = "inline-block"; + predictButton.innerHTML = ' Predicting...'; + + const formData = new FormData(form); + fetch("/predict_sports_ball", { + method: "POST", + body: formData, + }) + .then(response => response.json()) + .then(data => { + // Hide loading icon and reset button text + loadingIcon.style.display = "none"; + predictButton.innerHTML = 'Predict'; + + displayPredictionResult(data); + }) + .catch(error => { + // Hide loading icon in case of error and reset button text + loadingIcon.style.display = "none"; + predictButton.innerHTML = 'Predict'; + + console.error("Error:", error); + }); + }); + + // Image preview on file input change + fileInput.addEventListener("change", function () { + const file = fileInput.files[0]; + if (file) { + displayImagePreview(file); + } + }); +}); + +function displayPredictionResult(data) { + const resultDiv = document.getElementById("predictionResult"); + if (data.confidence < 75) { + alert("Please upload a valid or clear image."); + } else { + resultDiv.innerHTML = ` +

Predicted: ${data.class}

+

Confidence: ${data.confidence}%

+ `; + } +} + +function displayImagePreview(file) { + const imagePreview = document.getElementById("imagePreview"); + const imagePreviewContainer = document.getElementById("imageContainer"); + + const reader = new FileReader(); + reader.onload = function (e) { + imagePreview.src = e.target.result; + }; + + reader.readAsDataURL(file); + imagePreviewContainer.style.display = "block"; +} diff --git a/models/weather/static/images/bg.jpg b/models/weather/static/images/bg.jpg new file mode 100644 index 0000000000000000000000000000000000000000..305eb481bfe2e9458f73adec9670919dc2bb4f41 --- /dev/null +++ b/models/weather/static/images/bg.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ef586d33e58a48364ede1116e1e9c41312cd97d34181f7d8366a617096377d0 +size 1270838 diff --git a/models/weather/static/images/bg2.jpg b/models/weather/static/images/bg2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5169474d8bcd4c0d6dd1e5eae7c89930a439eeda --- /dev/null +++ b/models/weather/static/images/bg2.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aa53336ea474cfddbb35a583cd8a114f67519f56d91601636d6daf228218a02f +size 4492799 diff --git a/models/weather/static/images/weather_bg.gif b/models/weather/static/images/weather_bg.gif new file mode 100644 index 0000000000000000000000000000000000000000..6f5e9731db3574afcead068bba78e7463d0d87c8 --- /dev/null +++ b/models/weather/static/images/weather_bg.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e92bfcbf3eb0e460147937d8b162e571098dfec2e20f2611a20a1e4b8d94122 +size 1791060 diff --git a/models/weather/static/weather.css b/models/weather/static/weather.css new file mode 100644 index 0000000000000000000000000000000000000000..ce0fb8ac1c274329689dfcf4b4ef56d22e8b0464 --- /dev/null +++ b/models/weather/static/weather.css @@ -0,0 +1,191 @@ +/* style.css */ + +body, html { + margin: 0; + padding: 0; + height: 100%; +} + +body { + background-image: url('images/bg.jpg'); + background-size: cover; + background-position: center; + background-repeat: no-repeat; + background-attachment: fixed; + font-family: 'Arial', sans-serif; + color: #333; + overflow-y: scroll; +} + +.container { + max-width: 600px; /* Adjust the max-width as needed */ + margin: 20px auto; + padding: 20px; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); + backdrop-filter: blur(0px); +} + +.header-container { + max-width: 600px; + margin: 0 auto; + border-radius: 8px; + padding: 20px; + border: 1px solid hsl(0, 0%, 100%); + border-radius: 10px; + text-align: center; + margin-bottom: 20px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 6); + margin: 20px auto 0; +} + + +h1 { + text-align: center; + font-family: "Archivo Black", sans-serif; + color: rgb(80, 118, 57); + font-weight: bold; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 70); + margin: 0; +} + + +#fileInputContainer { + position: relative; + margin-bottom: 20px; + border: 1px solid ##3498db; + +} + +#fileInput { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + opacity: 0; + cursor: pointer; + backdrop-filter: blur(0px); + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); +} + +#fileInputLabel { + display: flex; + flex-direction: column; + align-items: center; + font-family: "Archivo Black", sans-serif; + justify-content: center; + font-size: 18px; + color: rgb(27, 101, 38); + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4); + cursor: pointer; + transition: color 0.3s ease; +} + +#fileInputLabel:hover { + color: #297fb8; +} + +#imagePreview { + max-width: 100%; + height: auto; + border: 0px solid #ddd; + border-radius: 8px; + padding: 10px; + backdrop-filter: blur(50px); + margin-bottom: 20px; + display: block; + margin: 0 auto; +} +#imageContainer { + text-align: center; + backdrop-filter: blur(10px); /* Adjust the blur value as needed */ + background-color: rgba(255, 255, 255, 0.5); /* Adjust the alpha value for transparency */ + border-radius: 8px; + padding: 10px; + margin-bottom: 20px; + display: block; + margin: 0 auto; +} + +.upload-icon { + font-size: 36px; + margin-bottom: 10px; +} + +.predict-btn { + width: 100%; + padding: 10px; + background-color:rgb(28, 68, 34); + color:white; + font-weight: bold; + border: none; + border-radius: 50px; + font-family: "Archivo Black", sans-serif; + cursor: pointer; + transition: background-color 0.3s; +} + +.predict-btn:hover { + background-color: #619a63; + letter-spacing: 2px; + box-shadow: #619a63 0px 7px 29px 0px; +} + +.predict-btn:active { + background-color: #619a63; + letter-spacing: 2px; + box-shadow: #619a63 0px 7px 29px 0px; + transform: translateY(10px); +} +.predict-btn:focus { + outline: none; +} + +#predictionResult { + color: white; /* Change the color to white */ + margin-top: 20px; + text-align: center; + backdrop-filter: blur(0px); + font-weight: bold; + border: none; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9) + box-shadow: none; +} + + +@media only screen and (max-width: 600px) { + h1{ + font-size:25px; + font-family: 'Kanit', sans-serif; + } + #imagePreview { + max-width: 70%; + height: 60%; + border: 0px solid #ddd; + border-radius: 8px; + padding: 10px; + backdrop-filter: blur(50px); + margin-bottom: 10px; + display: block; + margin: 0 auto; +} + body { + background-size: cover; /* or 'contain' based on your preference */ + } +} +.loading-icon { + display: none; + border: 4px solid #f3f3f3; + border-top: 4px solid #3498db; + border-radius: 50%; + width: 20px; + height: 20px; + animation: spin 1s linear infinite; +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} \ No newline at end of file diff --git a/models/weather/static/weather.js b/models/weather/static/weather.js new file mode 100644 index 0000000000000000000000000000000000000000..c3716ed119f902e0996617304c8151651e705821 --- /dev/null +++ b/models/weather/static/weather.js @@ -0,0 +1,69 @@ +document.addEventListener("DOMContentLoaded", function () { + const form = document.getElementById("uploadForm"); + const fileInput = document.getElementById("fileInput"); + const predictButton = document.getElementById("predictButton"); + const loadingIcon = document.getElementById("loadingIcon"); + + form.addEventListener("submit", function (event) { + event.preventDefault(); + + // Show loading icon and change button text + loadingIcon.style.display = "inline-block"; + predictButton.innerHTML = ' Predicting...'; + + const formData = new FormData(form); + fetch("/predict_weather", { + method: "POST", + body: formData, + }) + .then(response => response.json()) + .then(data => { + // Hide loading icon and reset button text + loadingIcon.style.display = "none"; + predictButton.innerHTML = 'Predict'; + + displayPredictionResult(data); + }) + .catch(error => { + // Hide loading icon in case of error and reset button text + loadingIcon.style.display = "none"; + predictButton.innerHTML = 'Predict'; + + console.error("Error:", error); + }); + }); + + // Image preview on file input change + fileInput.addEventListener("change", function () { + const file = fileInput.files[0]; + if (file) { + displayImagePreview(file); + } + }); +}); + +function displayPredictionResult(data) { + const resultDiv = document.getElementById("predictionResult"); + if (data.confidence < 75) { + alert("Please upload a valid or clear image."); + } else { + resultDiv.innerHTML = ` +

Predicted: ${data.class}

+

Confidence: ${data.confidence}%

+ `; + } +} + + +function displayImagePreview(file) { + const imagePreview = document.getElementById("imagePreview"); + const imagePreviewContainer = document.getElementById("imagePreviewContainer"); + + const reader = new FileReader(); + reader.onload = function (e) { + imagePreview.src = e.target.result; + }; + + reader.readAsDataURL(file); + imagePreviewContainer.style.display = "block"; +} diff --git a/models/weather/weather.html b/models/weather/weather.html new file mode 100644 index 0000000000000000000000000000000000000000..0b8f9f6acaec363968de8b8321244b51dd52db47 --- /dev/null +++ b/models/weather/weather.html @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + Weather Prediction + + +
+

Weather Prediction

+
+
+
+ + +
+
+ +
+
+ +
+ + + + + + \ No newline at end of file diff --git a/models/weather/weather_prediction_v2.h5 b/models/weather/weather_prediction_v2.h5 new file mode 100644 index 0000000000000000000000000000000000000000..1cd013141bda1ba3e723cbbb5b58f6a7243eb961 --- /dev/null +++ b/models/weather/weather_prediction_v2.h5 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:09e4591d606db0d0b64789a3557a1b822423898f2b584b294230a8d3313c9597 +size 11711744 diff --git a/models/weather/weather_predictionv1.h5 b/models/weather/weather_predictionv1.h5 new file mode 100644 index 0000000000000000000000000000000000000000..87faf49b87f4ea604f61bc8c920f48b4c1eb1e5b --- /dev/null +++ b/models/weather/weather_predictionv1.h5 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d89d80c858790b7a227d57248c2e46c58c8274808b4e35c731492b8fe976a020 +size 10205616 diff --git a/models/yoga_pose/static/images/yoga-background.jpg b/models/yoga_pose/static/images/yoga-background.jpg new file mode 100644 index 0000000000000000000000000000000000000000..50df14ed1b33a809fd2725782d77930394537feb Binary files /dev/null and b/models/yoga_pose/static/images/yoga-background.jpg differ diff --git a/models/yoga_pose/static/yoga_pose.css b/models/yoga_pose/static/yoga_pose.css new file mode 100644 index 0000000000000000000000000000000000000000..a7e778f281c8b9c698b47867754c7a4c8bb6d75e --- /dev/null +++ b/models/yoga_pose/static/yoga_pose.css @@ -0,0 +1,189 @@ +/* style.css */ + +body, html { + margin: 0; + padding: 0; + height: 100%; +} + +body { + background-image: url('images/yoga-background.jpg'); + background-size: cover; + background-position: center; + background-repeat: no-repeat; + font-family: 'Arial', sans-serif; + color: #333; + overflow-y: scroll; + background-attachment: fixed; +} + +.container { + max-width: 600px; /* Adjust the max-width as needed */ + margin: 20px auto; + padding: 20px; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); + backdrop-filter: blur(0px); +} + +.header-container { + max-width: 600px; + margin: 0 auto; + background-color: ##f4d03f;/* Adjust the alpha value for transparency */ + border-radius: 8px; + padding: 20px; + border: 1px solid ##3498db; + border-radius: 10px; + text-align: center; + margin-bottom: 20px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); + backdrop-filter: blur(0px); + margin: 20px auto 0 +} + + +h1 { + text-align: center; + color: rgba(19, 180, 153, 0.959); + font-weight: bold; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6); + margin: 0; +} + + +#fileInputContainer { + position: relative; + margin-bottom: 20px; + + +} + +#fileInput { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + opacity: 0; + cursor: pointer; + backdrop-filter: blur(0px); + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); +} + +#fileInputLabel { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: 18px; + color: #c5d437; + + font-weight: bold; + cursor: pointer; + transition: color 0.3s ease; +} + +#fileInputLabel:hover { + color: #297fb8; +} + +#imagePreview { + max-width: 100%; + height: auto; + border: 0px solid #ddd; + border-radius: 8px; + padding: 10px; + backdrop-filter: blur(50px); + margin-bottom: 20px; + display: block; + margin: 0 auto; +} +#imageContainer { + text-align: center; + backdrop-filter: blur(10px); /* Adjust the blur value as needed */ + + border-radius: 8px; + padding: 10px; + margin-bottom: 20px; + display: block; + margin: 0 auto; +} + +.upload-icon { + font-size: 36px; + margin-bottom: 10px; +} + +.predict-btn { + width: 100%; + padding: 10px; + background-color:rgb(12, 184, 161); + color:white; + font-weight: bold; + border: none; + border-radius: 50px; + cursor: pointer; + transition: background-color 0.3s; +} + +.predict-btn:hover { + background-color: #33aa3d; + letter-spacing: 2px; + box-shadow: #33aa3d 0px 4px 10px 0px; +} + +.predict-btn:active { + background-color: #33aa3d; + letter-spacing: 2px; + transform: translateY(10px); +} +.predict-btn:focus { + outline: none; +} + +#predictionResult { + color: white; /* Change the color to white */ + margin-top: 20px; + text-align: center; + backdrop-filter: blur(0px); + font-weight: bold; + border: none; + box-shadow: none; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9) + box-shadow: none; +} +@media only screen and (max-width: 600px) { + h1{ + font-size:25px; + font-family: 'Kanit', sans-serif; + } + #imagePreview { + max-width: 70%; + height: 60%; + border: 0px solid #ddd; + border-radius: 8px; + padding: 10px; + backdrop-filter: blur(50px); + margin-bottom: 10px; + display: block; + margin: 0 auto; +} + body { + background-size: cover; /* or 'contain' based on your preference */ + } +} +.loading-icon { + display: none; + border: 4px solid #f3f3f3; + border-top: 4px solid #3498db; + border-radius: 50%; + width: 20px; + height: 20px; + animation: spin 1s linear infinite; +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} \ No newline at end of file diff --git a/models/yoga_pose/static/yoga_script.js b/models/yoga_pose/static/yoga_script.js new file mode 100644 index 0000000000000000000000000000000000000000..7f2c54ec7bff742c199fb88bd1e4dd7e3c6603c8 --- /dev/null +++ b/models/yoga_pose/static/yoga_script.js @@ -0,0 +1,68 @@ +document.addEventListener("DOMContentLoaded", function () { + const form = document.getElementById("uploadForm"); + const fileInput = document.getElementById("fileInput"); + const predictButton = document.getElementById("predictButton"); + const loadingIcon = document.getElementById("loadingIcon"); + + form.addEventListener("submit", function (event) { + event.preventDefault(); + + // Show loading icon and change button text + loadingIcon.style.display = "inline-block"; + predictButton.innerHTML = ' Predicting...'; + + const formData = new FormData(form); + fetch("/predict_yoga_pose", { + method: "POST", + body: formData, + }) + .then(response => response.json()) + .then(data => { + // Hide loading icon and reset button text + loadingIcon.style.display = "none"; + predictButton.innerHTML = 'Predict'; + + displayPredictionResult(data); + }) + .catch(error => { + // Hide loading icon in case of error and reset button text + loadingIcon.style.display = "none"; + predictButton.innerHTML = 'Predict'; + + console.error("Error:", error); + }); + }); + + // Image preview on file input change + fileInput.addEventListener("change", function () { + const file = fileInput.files[0]; + if (file) { + displayImagePreview(file); + } + }); +}); + +function displayPredictionResult(data) { + const resultDiv = document.getElementById("predictionResult"); + if (data.confidence < 75) { + alert("Please upload a valid or clear image."); + } else { + resultDiv.innerHTML = ` +

Predicted: ${data.class}

+

Confidence: ${data.confidence}%

+ `; + } +} + +function displayImagePreview(file) { + const imagePreview = document.getElementById("imagePreview"); + const imagePreviewContainer = document.getElementById("imagePreviewContainer"); + + const reader = new FileReader(); + reader.onload = function (e) { + imagePreview.src = e.target.result; + }; + + reader.readAsDataURL(file); + imagePreviewContainer.style.display = "block"; +} diff --git a/models/yoga_pose/yoga-modelv2.h5 b/models/yoga_pose/yoga-modelv2.h5 new file mode 100644 index 0000000000000000000000000000000000000000..afe34785c9e8d42aeab3f97223c3cd637d4b2125 --- /dev/null +++ b/models/yoga_pose/yoga-modelv2.h5 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a98da672e9c672724b3d4ebec4193cf93cdd338dd12e0b67b6586d8ae62457c +size 3842552 diff --git a/models/yoga_pose/yoga_pose.html b/models/yoga_pose/yoga_pose.html new file mode 100644 index 0000000000000000000000000000000000000000..eea7aee4208fb83d91706c35df92fecc488f6f36 --- /dev/null +++ b/models/yoga_pose/yoga_pose.html @@ -0,0 +1,39 @@ + + + + + + + + + + + Yoga Pose + + +
+

Yoga Pose Classifier

+
+
+
+ + +
+
+ +
+
+ +
+ + + + + + \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..3263191de6083d99900bb14f0fb06e8642935bf6 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,8 @@ +numpy==1.24.3 +uvicorn==0.25.0 +fastapi==0.103.2 +gunicorn +Pillow==10.1.0 +jinja2 +python-multipart +tensorflow==2.13.1 \ No newline at end of file diff --git a/server.py b/server.py new file mode 100644 index 0000000000000000000000000000000000000000..3edac66ce4b488516fa222d702be62a7dea5e1b8 --- /dev/null +++ b/server.py @@ -0,0 +1,328 @@ +# server.py +import uvicorn +from fastapi import FastAPI, File, UploadFile +from fastapi.responses import HTMLResponse +from fastapi.staticfiles import StaticFiles +from fastapi.templating import Jinja2Templates +import numpy as np +from fastapi.middleware.cors import CORSMiddleware +import tensorflow as tf +from PIL import Image +from io import BytesIO +from fastapi import Request + +# Initializing The App +app = FastAPI() + +# Secure Our APP Server +app.add_middleware( + CORSMiddleware, + allow_origins=["*"], + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) + +# Mounting +app.mount("/static", StaticFiles(directory="frontend/static"), name="static") +app.mount("/models/yoga_pose/static", StaticFiles(directory='models/yoga_pose/static'), name='static_yoga_pose') +app.mount("/models/weather/static", StaticFiles(directory='models/weather/static'), name='static_weather') +app.mount("/models/sports_ball/static", StaticFiles(directory='models/sports_ball/static'), name='static_sports_ball') +app.mount("/models/mammals/static", StaticFiles(directory='models/mammals/static'), name='static_mammals') +app.mount("/models/flower/static", StaticFiles(directory='models/flower/static'), name='static_flower') +app.mount("/models/card/static", StaticFiles(directory='models/card/static'), name='static_card') +app.mount("/models/dog_breed/static", StaticFiles(directory='models/dog_breed/static'), name='static_dog_breed') +app.mount("/models/chess/static", StaticFiles(directory='models/chess/static'), name='static_chess') +app.mount("/models/bird/static", StaticFiles(directory='models/bird/static'), name='static_bird') + +# templates +templates = Jinja2Templates(directory="frontend") +templates1 = Jinja2Templates(directory="models") + +# DL or Ml Models (Loading).. +sports_ball_model = tf.keras.models.load_model('models/sports_ball/Sports_ball_prediction_v2.h5') +weather_model = tf.keras.models.load_model('models/weather/weather_prediction_v2.h5') +flower_model = tf.keras.models.load_model('models/flower/flower_prediction.h5') +yoga_pose_model = tf.keras.models.load_model('models/yoga_pose/yoga-modelv2.h5') +mammals_model = tf.keras.models.load_model('models/mammals/Mammals_predictionv1.h5') +card_model = tf.keras.models.load_model('models/card/card_model_v2.h5') +dog_breed_model = tf.keras.models.load_model("models/dog_breed/dog_breedv3.h5") +chess_model = tf.keras.models.load_model("models/chess/chess_prediction_v4.h5") +bird_model = tf.keras.models.load_model("models/bird/bird_modelV2.h5") + +# classes For All Models +yoga_class = ['Bridge Pose', 'Child-Pose', 'CobraPose', + 'Downward Dog pose', 'Pigeon pose', 'Standing Mountain Pose', + 'Tree Pose', 'Triangle Pose', 'Warrior Pose'] + +sports_ball_class = ['american_football', 'baseball', 'basketball', 'billiard_ball', 'bowling_ball', 'cricket_ball', + 'football', 'golf_ball', 'hockey_ball', 'hockey_puck', 'rugby_ball', 'shuttlecock', + 'table_tennis_ball', 'tennis_ball', 'volleyball'] + +flower_class = ['astilbe', 'bellflower', 'black_eyed_susan', 'calendula', 'california_poppy', 'carnation', + 'common_daisy', 'coreopsis', 'dandelion', 'iris', 'rose', 'sunflower', 'tulip', 'water_lily'] + +mammals_class = ['african_elephant', 'alpaca', 'american_bison', 'anteater', 'arctic_fox', 'armadillo', 'baboon', + 'badger', 'blue_whale', 'brown_bear', 'camel', 'dolphin', 'giraffe', 'groundhog', 'highland_cattle', + 'horse', 'jackal', 'kangaroo', 'koala', 'manatee', 'mongoose', 'mountain_goat', 'opossum', 'orangutan', + 'otter', 'polar_bear', 'porcupine', 'red_panda', 'rhinoceros', 'sea_lion', 'seal', 'snow_leopard', + 'squirrel', 'sugar_glider', 'tapir', 'vampire_bat', 'vicuna', 'walrus', 'warthog', 'water_buffalo', + 'weasel', 'wildebeest', 'wombat', 'yak', 'zebra'] + +cards_class = ['ace of clubs', 'ace of diamonds', 'ace of hearts', 'ace of spades', 'eight of clubs', + 'eight of diamonds', 'eight of hearts', 'eight of spades', 'five of clubs', 'five of diamonds', + 'five of hearts', 'five of spades', 'four of clubs', 'four of diamonds', 'four of hearts', + 'four of spades', 'jack of clubs', 'jack of diamonds', 'jack of hearts', 'jack of spades', 'joker', + 'king of clubs', 'king of diamonds', 'king of hearts', 'king of spades', 'nine of clubs', + 'nine of diamonds', 'nine of hearts', 'nine of spades', 'queen of clubs', 'queen of diamonds', + 'queen of hearts', 'queen of spades', 'seven of clubs', 'seven of diamonds', 'seven of hearts', + 'seven of spades', 'six of clubs', 'six of diamonds', 'six of hearts', 'six of spades', 'ten of clubs', + 'ten of diamonds', 'ten of hearts', 'ten of spades', 'three of clubs', 'three of diamonds', + 'three of hearts', 'three of spades', 'two of clubs', 'two of diamonds', 'two of hearts', + 'two of spades'] + +weather_class = ['dew', 'fogsmog', 'frost', 'glaze', 'hail', 'lightning', 'rain', 'rainbow', 'rime', 'sandstorm', + 'snow'] + +dog_breed_class = ['Afghan','African Wild Dog', 'Airedale', 'American Hairless','American Spaniel', 'Basenji', 'Basset', + 'Beagle', 'Bearded Collie', 'Bermaise', 'Bichon Frise', 'Blenheim', 'Bloodhound', 'Bluetick', + 'Border Collie','Borzoi','Boston Terrier', 'Boxer', 'Bull Mastiff', 'Bull Terrier', 'Bulldog', + 'Cairn', 'Chihuahua', 'Chinese Crested','Chow', 'Clumber','Cockapoo', 'Cocker', 'Collie', 'Corgi', + 'Coyote', 'Dalmation', 'Dhole', 'Dingo', 'Doberman', 'Elk Hound', 'French Bulldog', 'German Sheperd', + 'Golden Retriever', 'Great Dane', 'Great Perenees', 'Greyhound', 'Groenendael', 'Irish Spaniel', + 'Irish Wolfhound', 'Japanese Spaniel', 'Komondor', 'Labradoodle', 'Labrador', 'Lhasa', 'Malinois', + 'Maltese', 'Mex Hairless', 'Newfoundland', 'Pekinese', 'Pit Bull', 'Pomeranian', 'Poodle', 'Pug', + 'Rhodesian', 'Rottweiler', 'Saint Bernard', 'Schnauzer', 'Scotch Terrier', 'Shar_Pei', 'Shiba Inu', + 'Shih-Tzu', 'Siberian Husky', 'Vizsla', 'Yorkie'] + +chess_class = ['Bishop', 'King', 'Knight', 'Pawn', 'Queen', 'Rook'] + +bird_class = ['Asian-Green-Bee-Eater', 'Brown-Headed-Barbet', 'Cattle-Egret', 'Common-Kingfisher', 'Common-Myna', + 'Common-Rosefinch', 'Common-Tailorbird', 'Coppersmith-Barbet', 'Forest-Wagtail', 'Gray-Wagtail', 'Hoopoe', + 'House-Crow', 'Indian-Grey-Hornbill', 'Indian-Peacock', 'Indian-Pitta', 'Indian-Roller', 'Jungle-Babbler', + 'Northern-Lapwing', 'Red-Wattled-Lapwing', 'Ruddy-Shelduck', 'Rufous-Treepie', 'Sarus-Crane', + 'White-Breasted-Kingfisher', 'White-Breasted-Waterhen', 'White-Wagtail'] + + +# HTML Responses +@app.get("/", response_class=HTMLResponse) +async def read_root(request: Request): + return templates.TemplateResponse("main.html", {"request": request}) + + +@app.get("/models/yoga_pose/yoga_pose.html", response_class=HTMLResponse) +async def read_yoga_pose(request: Request): + return templates1.TemplateResponse("yoga_pose/yoga_pose.html", {"request": request}) + + +@app.get("/models/weather/weather.html", response_class=HTMLResponse) +async def read_weather(request: Request): + return templates1.TemplateResponse("weather/weather.html", {"request": request}) + + +@app.get("/models/sports_ball/sports_ball.html", response_class=HTMLResponse) +async def read_sports_ball(request: Request): + return templates1.TemplateResponse("sports_ball/sports_ball.html", {"request": request}) + + +@app.get("/models/mammals/mammals.html", response_class=HTMLResponse) +async def read_mammals(request: Request): + return templates1.TemplateResponse("mammals/mammals.html", {"request": request}) + + +@app.get("/models/flower/flower.html", response_class=HTMLResponse) +async def read_flower(request: Request): + return templates1.TemplateResponse("flower/flower.html", {"request": request}) + + +@app.get("/models/card/card.html", response_class=HTMLResponse) +async def read_card(request: Request): + return templates1.TemplateResponse("card/card.html", {"request": request}) + + +@app.get("/models/dog_breed/dog_breed.html", response_class=HTMLResponse) +async def read_dog_breed(request: Request): + return templates1.TemplateResponse("dog_breed/dog_breed.html", {"request": request}) + + +@app.get("/models/chess/chess.html", response_class=HTMLResponse) +async def read_chess(request: Request): + return templates1.TemplateResponse("chess/chess.html", {"request": request}) + + +@app.get("/models/bird/bird.html", response_class=HTMLResponse) +async def read_bird(request: Request): + return templates1.TemplateResponse("bird/bird.html", {"request": request}) + + +# Function Converting Img --> Array +def read_file_as_image(data): + img = Image.open(BytesIO(data)).resize((224, 224)) + img_array = tf.keras.preprocessing.image.img_to_array(img) + return img_array + + +# Endpoint for Sports Ball Model +@app.post("/predict_sports_ball") +async def predict_sports_ball(file: UploadFile = File(...)): + print("Sports Ball Prediction endpoint called") + file.file.seek(0) + img = read_file_as_image(await file.read()) + img = np.expand_dims(img, axis=0) + + predicted = sports_ball_model.predict(img) + result = sports_ball_class[np.argmax(predicted[0])] + confidence = np.max(predicted[0]) + + return { + 'class': result, + 'confidence': round(confidence * 100, 1) + } + + +# EndPoint For Flower Model +@app.post("/predict_flower") +async def predict_flower(file: UploadFile = File(...)): + print("Flower Prediction endpoint called") + file.file.seek(0) + img = read_file_as_image(await file.read()) + img = np.expand_dims(img, axis=0) + + predicted = flower_model.predict(img) + result = flower_class[np.argmax(predicted[0])] + confidence = np.max(predicted[0]) + + return { + 'class': result, + 'confidence': round(confidence * 100, 1) + } + + +# Endpoint for Weather Model +@app.post("/predict_weather") +async def weather(file: UploadFile = File(...)): + print("Weather Prediction endpoint called") + file.file.seek(0) + img = read_file_as_image(await file.read()) + img = np.expand_dims(img, axis=0) + + predicted = weather_model.predict(img) + result = weather_class[np.argmax(predicted[0])] + confidence = np.max(predicted[0]) + + return { + 'class': result, + 'confidence': round(confidence * 100, 1) + } + + +# Endpoint for Yoga Pose Model +@app.post("/predict_yoga_pose") +async def predict_yoga_pose(file: UploadFile = File(...)): + print("Yoga Prediction endpoint called") + file.file.seek(0) + img = read_file_as_image(await file.read()) + img = np.expand_dims(img, axis=0) + + predicted = yoga_pose_model.predict(img) + result = yoga_class[np.argmax(predicted[0])] + confidence = np.max(predicted[0]) + + return { + 'class': result, + 'confidence': round(confidence * 100, 1) + } + + +# Endpoint for Mammals Model +@app.post("/predict_mammals") +async def predict_mammals(file: UploadFile = File(...)): + print("Mammals Prediction endpoint called") + file.file.seek(0) + img = read_file_as_image(await file.read()) + img = np.expand_dims(img, axis=0) + + predicted = mammals_model.predict(img) + result = mammals_class[np.argmax(predicted[0])] + confidence = np.max(predicted[0]) + + return { + 'class': result, + 'confidence': round(confidence * 100, 1) + } + + +# Endpoint for card Model +@app.post("/predict_card") +async def predict_card(file: UploadFile = File(...)): + print("card Prediction endpoint called") + file.file.seek(0) + img = read_file_as_image(await file.read()) + img = np.expand_dims(img, axis=0) + + predicted = card_model.predict(img) + result = cards_class[np.argmax(predicted[0])] + confidence = np.max(predicted[0]) + + return { + 'class': result, + 'confidence': round(confidence * 100, 1) + } + + +# Endpoint for Dog Breed Model +@app.post("/predict_dog_breed") +async def predict_dog_breed(file: UploadFile = File(...)): + print("Dog Breed Prediction endpoint called") + file.file.seek(0) + img = read_file_as_image(await file.read()) + img = np.expand_dims(img, axis=0) + + predicted = dog_breed_model.predict(img) + result = dog_breed_class[np.argmax(predicted[0])] + confidence = np.max(predicted[0]) + + return { + 'class': result, + 'confidence': round(confidence * 100, 1) + } + + +# Endpoint for chess Model +@app.post("/predict_chess") +async def predict_chess(file: UploadFile = File(...)): + print("Chess Prediction endpoint called") + file.file.seek(0) + img = read_file_as_image(await file.read()) + img = np.expand_dims(img, axis=0) + + predicted = chess_model.predict(img) + result = chess_class[np.argmax(predicted[0])] + confidence = np.max(predicted[0]) + + return { + 'class': result, + 'confidence': round(confidence * 100, 1) + } + + +# Endpoint for bird Model +@app.post("/predict_bird") +async def predict_bird(file: UploadFile = File(...)): + print("bird Prediction endpoint called") + file.file.seek(0) + img = read_file_as_image(await file.read()) + img = np.expand_dims(img, axis=0) + + predicted = bird_model.predict(img) + result = bird_class[np.argmax(predicted[0])] + confidence = np.max(predicted[0]) + + return { + 'class': result, + 'confidence': round(confidence * 100, 1) + } + +# Run The Server In Localhost via Uvicorn +if __name__ == '__main__': + uvicorn.run(app, host='localhost', port=8000)