Spaces:
Sleeping
Sleeping
Mr-Vicky-01
commited on
Commit
•
a1c6194
1
Parent(s):
d61351c
Upload 63 files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +11 -0
- Dockerfile +27 -0
- frontend/main.html +73 -0
- frontend/static/images/neurons.gif +3 -0
- frontend/static/main.css +125 -0
- models/bird/bird.html +39 -0
- models/bird/bird_modelV2.h5 +3 -0
- models/bird/static/bird.css +193 -0
- models/bird/static/bird.js +68 -0
- models/bird/static/images/bg1.jpg +3 -0
- models/bird/static/images/bg2.jpg +3 -0
- models/bird/static/images/bg3.jpg +3 -0
- models/bird/static/images/bg4.jpg +0 -0
- models/card/card.html +39 -0
- models/card/card_model_v2.h5 +3 -0
- models/card/static/card.css +197 -0
- models/card/static/card.js +69 -0
- models/card/static/images/bg1.webp +0 -0
- models/card/static/images/bg2.jpg +0 -0
- models/chess/chess.html +39 -0
- models/chess/chess_prediction_v4.h5 +3 -0
- models/chess/static/chess.css +193 -0
- models/chess/static/chess.js +68 -0
- models/chess/static/images/bg1.jpg +3 -0
- models/chess/static/images/bg2.jpg +3 -0
- models/dog_breed/dog_breed.html +34 -0
- models/dog_breed/dog_breedv3.h5 +3 -0
- models/dog_breed/static/dog_breed.css +191 -0
- models/dog_breed/static/dog_breed.js +70 -0
- models/dog_breed/static/images/bg1.jpg +0 -0
- models/dog_breed/static/images/bg2.jpg +0 -0
- models/flower/flower.html +34 -0
- models/flower/flower_prediction.h5 +3 -0
- models/flower/static/flower.css +189 -0
- models/flower/static/flower.js +70 -0
- models/flower/static/images/bg1.jpeg +0 -0
- models/flower/static/images/bg2.jpg +0 -0
- models/mammals/Mammals_predictionv1.h5 +3 -0
- models/mammals/mammals.html +39 -0
- models/mammals/static/images/forest image.jpg +3 -0
- models/mammals/static/mammals.css +199 -0
- models/mammals/static/mammals.js +69 -0
- models/sports_ball/Sports_ball_prediction_v2.h5 +3 -0
- models/sports_ball/sports_ball.html +39 -0
- models/sports_ball/static/images/balls.jpg +0 -0
- models/sports_ball/static/images/bg10.gif +3 -0
- models/sports_ball/static/images/ronaldo.gif +0 -0
- models/sports_ball/static/sports_ball.css +195 -0
- models/sports_ball/static/sports_ball.js +69 -0
- models/weather/static/images/bg.jpg +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,14 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
frontend/static/images/neurons.gif filter=lfs diff=lfs merge=lfs -text
|
37 |
+
models/bird/static/images/bg1.jpg filter=lfs diff=lfs merge=lfs -text
|
38 |
+
models/bird/static/images/bg2.jpg filter=lfs diff=lfs merge=lfs -text
|
39 |
+
models/bird/static/images/bg3.jpg filter=lfs diff=lfs merge=lfs -text
|
40 |
+
models/chess/static/images/bg1.jpg filter=lfs diff=lfs merge=lfs -text
|
41 |
+
models/chess/static/images/bg2.jpg filter=lfs diff=lfs merge=lfs -text
|
42 |
+
models/mammals/static/images/forest[[:space:]]image.jpg filter=lfs diff=lfs merge=lfs -text
|
43 |
+
models/sports_ball/static/images/bg10.gif filter=lfs diff=lfs merge=lfs -text
|
44 |
+
models/weather/static/images/bg.jpg filter=lfs diff=lfs merge=lfs -text
|
45 |
+
models/weather/static/images/bg2.jpg filter=lfs diff=lfs merge=lfs -text
|
46 |
+
models/weather/static/images/weather_bg.gif filter=lfs diff=lfs merge=lfs -text
|
Dockerfile
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use the official Python 3.9 image
|
2 |
+
FROM python:3.9
|
3 |
+
|
4 |
+
# Set the working directory to /code
|
5 |
+
WORKDIR /code
|
6 |
+
|
7 |
+
# Copy the current directory contents into the container at /code
|
8 |
+
COPY ./requirements.txt /code/requirements.txt
|
9 |
+
|
10 |
+
# Install requirements.txt
|
11 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
12 |
+
|
13 |
+
# Set up a new user named "user" with user ID 1000
|
14 |
+
RUN useradd -m -u 1000 user
|
15 |
+
# Switch to the "user" user
|
16 |
+
USER user
|
17 |
+
# Set home to the user's home directory
|
18 |
+
ENV HOME=/home/user \
|
19 |
+
PATH=/home/user/.local/bin:$PATH
|
20 |
+
|
21 |
+
# Set the working directory to the user's home directory
|
22 |
+
WORKDIR $HOME/app
|
23 |
+
|
24 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
25 |
+
COPY --chown=user . $HOME/app
|
26 |
+
|
27 |
+
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]
|
frontend/main.html
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Deep Learning Models</title>
|
7 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
8 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
9 |
+
<link href="https://fonts.googleapis.com/css2?family=Acme&family=Asap:ital,wght@0,100..900;1,100..900&family=Caprasimo&family=Lemon&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Salsa&display=swap" rel="stylesheet">
|
10 |
+
<link rel="stylesheet" href="static/main.css?v=3">
|
11 |
+
</head>
|
12 |
+
<body>
|
13 |
+
<div class="container">
|
14 |
+
<h1>Deep Learning Models</h1>
|
15 |
+
|
16 |
+
<div class="model-list">
|
17 |
+
<div class="model">
|
18 |
+
<h2>Flower Classification🌼</h2>
|
19 |
+
<p>This model classifies different types of flowers in images.</p>
|
20 |
+
<a href="models/flower/flower.html">Use this model</a>
|
21 |
+
</div>
|
22 |
+
|
23 |
+
<div class="model">
|
24 |
+
<h2>Mammals Classification🦁</h2>
|
25 |
+
<p>This model classifies images into different mammal categories..</p>
|
26 |
+
<a href="models/mammals/mammals.html">Use this model</a>
|
27 |
+
</div>
|
28 |
+
|
29 |
+
<div class="model">
|
30 |
+
<h2>Cards Classification♠</h2>
|
31 |
+
<p>This model identifies Cards realted to the images.</p>
|
32 |
+
<a href="models/card/card.html">Use this model</a>
|
33 |
+
</div>
|
34 |
+
|
35 |
+
<div class="model">
|
36 |
+
<h2>Weather Classification</h2>
|
37 |
+
<p>This model predicts the weather.</p>
|
38 |
+
<a href="models/weather/weather.html">Use this model</a>
|
39 |
+
</div>
|
40 |
+
|
41 |
+
<div class="model">
|
42 |
+
<h2>Yoga Pose Prediction</h2>
|
43 |
+
<p>This model predicts the yoga pose in images related to the yoga position</p>
|
44 |
+
<a href="models/yoga_pose/yoga_pose.html">Use this model</a>
|
45 |
+
</div>
|
46 |
+
|
47 |
+
<div class="model">
|
48 |
+
<h2>Indian Bird Prediction</h2>
|
49 |
+
<p>This model Classify the Indian Birds</p>
|
50 |
+
<a href="models/bird/bird.html">Use this model</a>
|
51 |
+
</div>
|
52 |
+
|
53 |
+
<div class="model">
|
54 |
+
<h2>Dog Breed Prediction🐕</h2>
|
55 |
+
<p>This model predicts your dog's breed</p>
|
56 |
+
<a href="models/dog_breed/dog_breed.html">Use this model</a>
|
57 |
+
</div>
|
58 |
+
|
59 |
+
<div class="model">
|
60 |
+
<h2>Chess Pieces Prediction</h2>
|
61 |
+
<p>This model Predict Your Chess Piece</p>
|
62 |
+
<a href="models/chess/chess.html">Use this model</a>
|
63 |
+
</div>
|
64 |
+
|
65 |
+
<div class="model">
|
66 |
+
<h2>Sports ball Prediction⚽</h2>
|
67 |
+
<p>This model classifies different types of sports ball</p>
|
68 |
+
<a href="models/sports_ball/sports_ball.html">Use this model</a>
|
69 |
+
</div>
|
70 |
+
</div>
|
71 |
+
</div>
|
72 |
+
</body>
|
73 |
+
</html>
|
frontend/static/images/neurons.gif
ADDED
Git LFS Details
|
frontend/static/main.css
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* main.css */
|
2 |
+
body {
|
3 |
+
font-family: "Libre Baskerville", serif;
|
4 |
+
font-weight: 400;
|
5 |
+
font-style: italic;
|
6 |
+
margin: 0;
|
7 |
+
padding: 0;
|
8 |
+
background: url('images/neurons.gif') no-repeat center center fixed;
|
9 |
+
background-size: cover;
|
10 |
+
background-attachment: fixed;
|
11 |
+
}
|
12 |
+
|
13 |
+
.container {
|
14 |
+
max-width: 600px;
|
15 |
+
margin: 10px auto;
|
16 |
+
background-color: rgba(0, 0, 0, 0.3); /* Add a semi-transparent white background on top of the GIF */
|
17 |
+
padding: 20px;
|
18 |
+
text-align: center;
|
19 |
+
border-radius: 8px;
|
20 |
+
box-shadow: 0 0 10px rgba(15, 166, 185, 0.897);
|
21 |
+
}
|
22 |
+
|
23 |
+
h1 {
|
24 |
+
color: #ffffff;
|
25 |
+
font-family: "Caprasimo", serif;
|
26 |
+
font-weight: 400;
|
27 |
+
font-style: normal;
|
28 |
+
}
|
29 |
+
|
30 |
+
.model-list {
|
31 |
+
display: flex;
|
32 |
+
flex-wrap: wrap;
|
33 |
+
justify-content: center;
|
34 |
+
}
|
35 |
+
|
36 |
+
.model {
|
37 |
+
width: 100%;
|
38 |
+
margin-bottom: 30px;
|
39 |
+
padding: 25px;
|
40 |
+
border: px solid #c71919;
|
41 |
+
border-radius: 5px;
|
42 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
43 |
+
|
44 |
+
backdrop-filter: blur(20px);
|
45 |
+
}
|
46 |
+
|
47 |
+
h2 {
|
48 |
+
color: #2bb1b6;
|
49 |
+
font-weight: bold;
|
50 |
+
font-family: "Bungee", sans-serif;
|
51 |
+
}
|
52 |
+
|
53 |
+
p {
|
54 |
+
color: #f3f3f3;
|
55 |
+
font-family: "Young Serif", serif;
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
a {
|
60 |
+
display: block;
|
61 |
+
margin-top: 10px;
|
62 |
+
padding: 8px;
|
63 |
+
background-color: #22b4ad;
|
64 |
+
color: #fff;
|
65 |
+
text-align: center;
|
66 |
+
text-decoration: none;
|
67 |
+
border-radius: 5px;
|
68 |
+
font-family: "Caprasimo", serif;
|
69 |
+
font-weight: 400;
|
70 |
+
font-style: normal;
|
71 |
+
transition: background-color 0.3s;
|
72 |
+
}
|
73 |
+
|
74 |
+
a:hover {
|
75 |
+
background-color: #009eb3;
|
76 |
+
letter-spacing: 3px;
|
77 |
+
}
|
78 |
+
|
79 |
+
a:active {
|
80 |
+
background-color: #009eb3;
|
81 |
+
letter-spacing: 2px;
|
82 |
+
box-shadow: #009eb3 0px 7px 29px 0px;
|
83 |
+
transform: translateY(10px);
|
84 |
+
}
|
85 |
+
a:focus {
|
86 |
+
outline: none;
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
/* Media Query for smaller screens */
|
91 |
+
@media only screen and (max-width: 600px) {
|
92 |
+
.model {
|
93 |
+
width: 100%;
|
94 |
+
}
|
95 |
+
h1{
|
96 |
+
font-size:25px;
|
97 |
+
}
|
98 |
+
|
99 |
+
.container {
|
100 |
+
max-width: 400px;
|
101 |
+
margin: 10px auto;
|
102 |
+
padding: 10px;
|
103 |
+
text-align: center;
|
104 |
+
}
|
105 |
+
|
106 |
+
h2{
|
107 |
+
font-size:20px
|
108 |
+
}
|
109 |
+
|
110 |
+
p{
|
111 |
+
font-size:13px
|
112 |
+
}
|
113 |
+
|
114 |
+
.container {
|
115 |
+
max-width: 100%;
|
116 |
+
margin: 5px auto;
|
117 |
+
padding: 20px;
|
118 |
+
text-align: center;
|
119 |
+
border-radius: 8px;
|
120 |
+
}
|
121 |
+
|
122 |
+
body {
|
123 |
+
background-size: cover; /* or 'contain' based on your preference */
|
124 |
+
}
|
125 |
+
}
|
models/bird/bird.html
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- bird.html -->
|
2 |
+
|
3 |
+
<!DOCTYPE html>
|
4 |
+
<html lang="en">
|
5 |
+
<head>
|
6 |
+
<meta charset="UTF-8">
|
7 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
8 |
+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
9 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
10 |
+
<link rel="stylesheet" href="static/bird.css?v=2">
|
11 |
+
<title>Bird Classification</title>
|
12 |
+
</head>
|
13 |
+
<body>
|
14 |
+
<div class="header-container container">
|
15 |
+
<h1>Bird Classification</h1>
|
16 |
+
</div>
|
17 |
+
<form id="uploadForm" action="/predict" method="post" enctype="multipart/form-data" class="container">
|
18 |
+
<div id="fileInputContainer">
|
19 |
+
<input type="file" name="file" id="fileInput" accept="image/*">
|
20 |
+
<label for="fileInput" id="fileInputLabel">
|
21 |
+
<i class="fas fa-cloud-upload-alt upload-icon"></i>
|
22 |
+
Drag & Drop or Click to Upload
|
23 |
+
</label>
|
24 |
+
</div>
|
25 |
+
<div id="imageContainer" class="container">
|
26 |
+
<img id="imagePreview">
|
27 |
+
</div>
|
28 |
+
<div id="predictionResult" class="container"></div>
|
29 |
+
<button type="submit" class="predict-btn" id="predictButton">
|
30 |
+
<span class="loading-icon" id="loadingIcon"></span>
|
31 |
+
Predict
|
32 |
+
</button>
|
33 |
+
</form>
|
34 |
+
<script src="static/bird.js"></script>
|
35 |
+
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
36 |
+
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js"></script>
|
37 |
+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
38 |
+
</body>
|
39 |
+
</html>
|
models/bird/bird_modelV2.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fe542ffd79ac5af88daa17361a3fc49a8120c9dece7fe5e62732f54e7cf5eb41
|
3 |
+
size 12552432
|
models/bird/static/bird.css
ADDED
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* style.css */
|
2 |
+
|
3 |
+
body, html {
|
4 |
+
margin: 0;
|
5 |
+
padding: 0;
|
6 |
+
height: 100%;
|
7 |
+
}
|
8 |
+
|
9 |
+
body {
|
10 |
+
background-image: url('images/bg4.jpg');
|
11 |
+
background-size: cover;
|
12 |
+
background-position: center;
|
13 |
+
background-repeat: no-repeat;
|
14 |
+
font-family: 'Arial', sans-serif;
|
15 |
+
color: #333;
|
16 |
+
overflow-y: scroll;
|
17 |
+
background-attachment: fixed;
|
18 |
+
}
|
19 |
+
|
20 |
+
.container {
|
21 |
+
max-width: 600px; /* Adjust the max-width as needed */
|
22 |
+
margin: 20px auto;
|
23 |
+
padding: 20px;
|
24 |
+
border-radius: 8px;
|
25 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
|
26 |
+
backdrop-filter: blur(0px);
|
27 |
+
}
|
28 |
+
|
29 |
+
.header-container {
|
30 |
+
max-width: 600px;
|
31 |
+
margin: 0 auto;
|
32 |
+
background-color: ##f4d03f;/* Adjust the alpha value for transparency */
|
33 |
+
border-radius: 8px;
|
34 |
+
padding: 20px;
|
35 |
+
border: 1px solid ##3498db;
|
36 |
+
border-radius: 10px;
|
37 |
+
text-align: center;
|
38 |
+
margin-bottom: 20px;
|
39 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 6);
|
40 |
+
backdrop-filter: blur(0px);
|
41 |
+
margin: 20px auto 0
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
h1 {
|
46 |
+
text-align: center;
|
47 |
+
color: rgb(255, 255, 255);
|
48 |
+
font-weight: bold;
|
49 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 8);
|
50 |
+
margin: 0;
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
+
#fileInputContainer {
|
55 |
+
position: relative;
|
56 |
+
margin-bottom: 20px;
|
57 |
+
|
58 |
+
|
59 |
+
}
|
60 |
+
|
61 |
+
#fileInput {
|
62 |
+
position: absolute;
|
63 |
+
top: 0;
|
64 |
+
left: 0;
|
65 |
+
width: 100%;
|
66 |
+
height: 100%;
|
67 |
+
opacity: 0;
|
68 |
+
cursor: pointer;
|
69 |
+
backdrop-filter: blur(0px);
|
70 |
+
border-radius: 8px;
|
71 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
|
72 |
+
}
|
73 |
+
|
74 |
+
#fileInputLabel {
|
75 |
+
display: flex;
|
76 |
+
flex-direction: column;
|
77 |
+
align-items: center;
|
78 |
+
justify-content: center;
|
79 |
+
font-size: 18px;
|
80 |
+
color: #ffd903;
|
81 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 2);
|
82 |
+
font-weight: bold;
|
83 |
+
cursor: pointer;
|
84 |
+
transition: color 0.3s ease;
|
85 |
+
}
|
86 |
+
|
87 |
+
#fileInputLabel:hover {
|
88 |
+
color: #297fb8;
|
89 |
+
}
|
90 |
+
|
91 |
+
#imagePreview {
|
92 |
+
max-width: 100%;
|
93 |
+
height: auto;
|
94 |
+
border: 0px solid #ddd;
|
95 |
+
border-radius: 8px;
|
96 |
+
padding: 10px;
|
97 |
+
backdrop-filter: blur(50px);
|
98 |
+
margin-bottom: 20px;
|
99 |
+
display: block;
|
100 |
+
margin: 0 auto;
|
101 |
+
}
|
102 |
+
#imageContainer {
|
103 |
+
text-align: center;
|
104 |
+
backdrop-filter: blur(10px); /* Adjust the blur value as needed */
|
105 |
+
|
106 |
+
border-radius: 8px;
|
107 |
+
padding: 10px;
|
108 |
+
margin-bottom: 20px;
|
109 |
+
display: block;
|
110 |
+
margin: 0 auto;
|
111 |
+
}
|
112 |
+
|
113 |
+
.upload-icon {
|
114 |
+
font-size: 36px;
|
115 |
+
margin-bottom: 10px;
|
116 |
+
}
|
117 |
+
|
118 |
+
.predict-btn {
|
119 |
+
width: 100%;
|
120 |
+
padding: 10px;
|
121 |
+
background-color:rgb(159, 172, 41);
|
122 |
+
color:white;
|
123 |
+
font-weight: bold;
|
124 |
+
border: none;
|
125 |
+
border-radius: 50px;
|
126 |
+
cursor: pointer;
|
127 |
+
transition: background-color 0.3s;
|
128 |
+
}
|
129 |
+
|
130 |
+
.predict-btn:hover {
|
131 |
+
background-color: #0c8b30;
|
132 |
+
letter-spacing: 2px;
|
133 |
+
box-shadow: #0c8b30 0px 7px 29px 0px;
|
134 |
+
}
|
135 |
+
|
136 |
+
.predict-btn:active {
|
137 |
+
background-color: #0c8b30;
|
138 |
+
letter-spacing: 2px;
|
139 |
+
box-shadow: #0c8b30 0px 7px 29px 0px;
|
140 |
+
transform: translateY(10px);
|
141 |
+
}
|
142 |
+
.predict-btn:focus {
|
143 |
+
outline: none;
|
144 |
+
}
|
145 |
+
|
146 |
+
#predictionResult {
|
147 |
+
color: white; /* Change the color to white */
|
148 |
+
margin-top: 20px;
|
149 |
+
text-align: center;
|
150 |
+
backdrop-filter: blur(0px);
|
151 |
+
font-weight: bold;
|
152 |
+
border: none;
|
153 |
+
box-shadow: none;
|
154 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 2);
|
155 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9)
|
156 |
+
box-shadow: none;
|
157 |
+
}
|
158 |
+
|
159 |
+
@media only screen and (max-width: 600px) {
|
160 |
+
h1{
|
161 |
+
font-size:25px;
|
162 |
+
font-family: 'Kanit', sans-serif;
|
163 |
+
}
|
164 |
+
#imagePreview {
|
165 |
+
max-width: 70%;
|
166 |
+
height: 60%;
|
167 |
+
border: 0px solid #ddd;
|
168 |
+
border-radius: 8px;
|
169 |
+
padding: 10px;
|
170 |
+
backdrop-filter: blur(50px);
|
171 |
+
margin-bottom: 10px;
|
172 |
+
display: block;
|
173 |
+
margin: 0 auto;
|
174 |
+
}
|
175 |
+
body {
|
176 |
+
background-size: fixed; /* or 'contain' based on your preference */
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
.loading-icon {
|
181 |
+
display: none;
|
182 |
+
border: 4px solid #f3f3f3;
|
183 |
+
border-top: 4px solid #3498db;
|
184 |
+
border-radius: 50%;
|
185 |
+
width: 20px;
|
186 |
+
height: 20px;
|
187 |
+
animation: spin 1s linear infinite;
|
188 |
+
}
|
189 |
+
|
190 |
+
@keyframes spin {
|
191 |
+
0% { transform: rotate(0deg); }
|
192 |
+
100% { transform: rotate(360deg); }
|
193 |
+
}
|
models/bird/static/bird.js
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
document.addEventListener("DOMContentLoaded", function () {
|
2 |
+
const form = document.getElementById("uploadForm");
|
3 |
+
const fileInput = document.getElementById("fileInput");
|
4 |
+
const predictButton = document.getElementById("predictButton");
|
5 |
+
const loadingIcon = document.getElementById("loadingIcon");
|
6 |
+
|
7 |
+
form.addEventListener("submit", function (event) {
|
8 |
+
event.preventDefault();
|
9 |
+
|
10 |
+
// Show loading icon and change button text
|
11 |
+
loadingIcon.style.display = "inline-block";
|
12 |
+
predictButton.innerHTML = '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Predicting...';
|
13 |
+
|
14 |
+
const formData = new FormData(form);
|
15 |
+
fetch("/predict_bird", {
|
16 |
+
method: "POST",
|
17 |
+
body: formData,
|
18 |
+
})
|
19 |
+
.then(response => response.json())
|
20 |
+
.then(data => {
|
21 |
+
// Hide loading icon and reset button text
|
22 |
+
loadingIcon.style.display = "none";
|
23 |
+
predictButton.innerHTML = 'Predict';
|
24 |
+
|
25 |
+
displayPredictionResult(data);
|
26 |
+
})
|
27 |
+
.catch(error => {
|
28 |
+
// Hide loading icon in case of error and reset button text
|
29 |
+
loadingIcon.style.display = "none";
|
30 |
+
predictButton.innerHTML = 'Predict';
|
31 |
+
|
32 |
+
console.error("Error:", error);
|
33 |
+
});
|
34 |
+
});
|
35 |
+
|
36 |
+
// Image preview on file input change
|
37 |
+
fileInput.addEventListener("change", function () {
|
38 |
+
const file = fileInput.files[0];
|
39 |
+
if (file) {
|
40 |
+
displayImagePreview(file);
|
41 |
+
}
|
42 |
+
});
|
43 |
+
});
|
44 |
+
|
45 |
+
function displayPredictionResult(data) {
|
46 |
+
const resultDiv = document.getElementById("predictionResult");
|
47 |
+
if (data.confidence < 75) {
|
48 |
+
alert("Please upload a valid or clear image.");
|
49 |
+
} else {
|
50 |
+
resultDiv.innerHTML = `
|
51 |
+
<p>Predicted: ${data.class}</p>
|
52 |
+
<p>Confidence: ${data.confidence}%</p>
|
53 |
+
`;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
function displayImagePreview(file) {
|
58 |
+
const imagePreview = document.getElementById("imagePreview");
|
59 |
+
const imagePreviewContainer = document.getElementById("imagePreviewContainer");
|
60 |
+
|
61 |
+
const reader = new FileReader();
|
62 |
+
reader.onload = function (e) {
|
63 |
+
imagePreview.src = e.target.result;
|
64 |
+
};
|
65 |
+
|
66 |
+
reader.readAsDataURL(file);
|
67 |
+
imagePreviewContainer.style.display = "block";
|
68 |
+
}
|
models/bird/static/images/bg1.jpg
ADDED
Git LFS Details
|
models/bird/static/images/bg2.jpg
ADDED
Git LFS Details
|
models/bird/static/images/bg3.jpg
ADDED
Git LFS Details
|
models/bird/static/images/bg4.jpg
ADDED
models/card/card.html
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- index.html -->
|
2 |
+
|
3 |
+
<!DOCTYPE html>
|
4 |
+
<html lang="en">
|
5 |
+
<head>
|
6 |
+
<meta charset="UTF-8">
|
7 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
8 |
+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
9 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
10 |
+
<link rel="stylesheet" href="static/card.css?v=3">
|
11 |
+
<title>Cards Prediction</title>
|
12 |
+
</head>
|
13 |
+
<body>
|
14 |
+
<div class="header-container container">
|
15 |
+
<h1>Cards Prediction</h1>
|
16 |
+
</div>
|
17 |
+
<form id="uploadForm" action="/predict" method="post" enctype="multipart/form-data" class="container">
|
18 |
+
<div id="fileInputContainer">
|
19 |
+
<input type="file" name="file" id="fileInput" accept="image/*">
|
20 |
+
<label for="fileInput" id="fileInputLabel">
|
21 |
+
<i class="fas fa-cloud-upload-alt upload-icon"></i>
|
22 |
+
Drag & Drop or Click to Upload
|
23 |
+
</label>
|
24 |
+
</div>
|
25 |
+
<div id="imageContainer" class="container">
|
26 |
+
<img id="imagePreview">
|
27 |
+
</div>
|
28 |
+
<div id="predictionResult" class="container"></div>
|
29 |
+
<button type="submit" class="predict-btn" id="predictButton">
|
30 |
+
<span class="loading-icon" id="loadingIcon"></span>
|
31 |
+
Predict
|
32 |
+
</button>
|
33 |
+
</form>
|
34 |
+
<script src="static/card.js"></script>
|
35 |
+
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
36 |
+
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js"></script>
|
37 |
+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
38 |
+
</body>
|
39 |
+
</html>
|
models/card/card_model_v2.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8ba7901ceb009883b4698b0e99aa1970a7d8360086b978a87fe9ed703d959979
|
3 |
+
size 9781296
|
models/card/static/card.css
ADDED
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* style.css */
|
2 |
+
|
3 |
+
body, html {
|
4 |
+
margin: 0;
|
5 |
+
padding: 0;
|
6 |
+
height: 100%;
|
7 |
+
}
|
8 |
+
|
9 |
+
body {
|
10 |
+
background-image: url('images/bg2.jpg');
|
11 |
+
background-size: cover;
|
12 |
+
background-position: center;
|
13 |
+
background-repeat: no-repeat;
|
14 |
+
font-family: 'Arial', sans-serif;
|
15 |
+
color: #333;
|
16 |
+
overflow-y: scroll;
|
17 |
+
background-attachment: fixed;
|
18 |
+
}
|
19 |
+
|
20 |
+
.container {
|
21 |
+
max-width: 600px; /* Adjust the max-width as needed */
|
22 |
+
margin: 20px auto;
|
23 |
+
padding: 20px;
|
24 |
+
border-radius: 8px;
|
25 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
|
26 |
+
backdrop-filter: blur(0px);
|
27 |
+
}
|
28 |
+
|
29 |
+
.header-container {
|
30 |
+
max-width: 600px;
|
31 |
+
margin: 0 auto;
|
32 |
+
background-color: #000000;/* Adjust the alpha value for transparency */
|
33 |
+
border-radius: 8px;
|
34 |
+
padding: 20px;
|
35 |
+
border: 1px solid hsl(0, 0%, 100%);
|
36 |
+
border-radius: 10px;
|
37 |
+
text-align: center;
|
38 |
+
margin-bottom: 20px;
|
39 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 6);
|
40 |
+
backdrop-filter: blur(30px);
|
41 |
+
margin: 20px auto 0;
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
h1 {
|
46 |
+
text-align: center;
|
47 |
+
color: rgb(255, 5, 5);
|
48 |
+
font-weight: bold;
|
49 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 20);
|
50 |
+
margin: 0;
|
51 |
+
font-family: 'Kanit', sans-serif;
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
#fileInputContainer {
|
56 |
+
position: relative;
|
57 |
+
margin-bottom: 20px;
|
58 |
+
border: 1px solid ##3498db;
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
+
#fileInput {
|
63 |
+
position: absolute;
|
64 |
+
top: 0;
|
65 |
+
left: 0;
|
66 |
+
width: 100%;
|
67 |
+
height: 100%;
|
68 |
+
opacity: 0;
|
69 |
+
cursor: pointer;
|
70 |
+
backdrop-filter: blur(0px);
|
71 |
+
border-radius: 8px;
|
72 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
|
73 |
+
}
|
74 |
+
|
75 |
+
#fileInputLabel {
|
76 |
+
display: flex;
|
77 |
+
flex-direction: column;
|
78 |
+
align-items: center;
|
79 |
+
justify-content: center;
|
80 |
+
font-size: 18px;
|
81 |
+
color: #ff0000;
|
82 |
+
font-family: 'Kanit', sans-serif;
|
83 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
|
84 |
+
font-weight: bold;
|
85 |
+
cursor: pointer;
|
86 |
+
transition: color 0.3s ease;
|
87 |
+
}
|
88 |
+
|
89 |
+
#fileInputLabel:hover {
|
90 |
+
color: #297fb8;
|
91 |
+
}
|
92 |
+
|
93 |
+
#imagePreview {
|
94 |
+
max-width: 50%;
|
95 |
+
max-height: 10%;
|
96 |
+
border: 0px solid #ddd;
|
97 |
+
border-radius: 8px;
|
98 |
+
padding: 10px;
|
99 |
+
backdrop-filter: blur(50px);
|
100 |
+
margin-bottom: 20px;
|
101 |
+
display: block;
|
102 |
+
margin: 0 auto;
|
103 |
+
}
|
104 |
+
|
105 |
+
#imageContainer {
|
106 |
+
text-align: center;
|
107 |
+
backdrop-filter: blur(10px); /* Adjust the blur value as needed */
|
108 |
+
background-color: rgba(0, 0, 0, 0.5); /* Adjust the alpha value for transparency */
|
109 |
+
border-radius: 8px;
|
110 |
+
padding: 10px;
|
111 |
+
margin-bottom: 20px;
|
112 |
+
display: block;
|
113 |
+
margin: 0 auto;
|
114 |
+
}
|
115 |
+
|
116 |
+
.upload-icon {
|
117 |
+
font-size: 36px;
|
118 |
+
margin-bottom: 10px;
|
119 |
+
}
|
120 |
+
|
121 |
+
.predict-btn {
|
122 |
+
width: 100%;
|
123 |
+
padding: 10px;
|
124 |
+
background-color:rgb(36, 3, 21);
|
125 |
+
color:white;
|
126 |
+
font-weight: bold;
|
127 |
+
border: none;
|
128 |
+
font-family: 'Kanit', sans-serif;
|
129 |
+
border-radius: 50px;
|
130 |
+
cursor: pointer;
|
131 |
+
transition: background-color 0.3s;
|
132 |
+
}
|
133 |
+
|
134 |
+
.predict-btn:hover {
|
135 |
+
background-color: #ff0000;
|
136 |
+
letter-spacing: 2px;
|
137 |
+
box-shadow: #ff0000 0px 7px 29px 0px;
|
138 |
+
}
|
139 |
+
|
140 |
+
.predict-btn:active {
|
141 |
+
background-color: #ff0000;
|
142 |
+
letter-spacing: 2px;
|
143 |
+
box-shadow: #ff0000 0px 7px 29px 0px;
|
144 |
+
transform: translateY(10px);
|
145 |
+
}
|
146 |
+
.predict-btn:focus {
|
147 |
+
outline: none;
|
148 |
+
}
|
149 |
+
|
150 |
+
#predictionResult {
|
151 |
+
color: white; /* Change the color to white */
|
152 |
+
margin-top: 20px;
|
153 |
+
text-align: center;
|
154 |
+
backdrop-filter: blur(40px);
|
155 |
+
font-weight: bold;
|
156 |
+
border: none;
|
157 |
+
font-size: 20px;
|
158 |
+
font-family: 'Kanit', sans-serif;
|
159 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
|
160 |
+
box-shadow: none;
|
161 |
+
}
|
162 |
+
|
163 |
+
@media only screen and (max-width: 600px) {
|
164 |
+
h1{
|
165 |
+
font-size:25px;
|
166 |
+
font-family: 'Kanit', sans-serif;
|
167 |
+
}
|
168 |
+
#imagePreview {
|
169 |
+
max-width: 70%;
|
170 |
+
height: 60%;
|
171 |
+
border: 0px solid #ddd;
|
172 |
+
border-radius: 8px;
|
173 |
+
padding: 10px;
|
174 |
+
backdrop-filter: blur(50px);
|
175 |
+
margin-bottom: 10px;
|
176 |
+
display: block;
|
177 |
+
margin: 0 auto;
|
178 |
+
}
|
179 |
+
body {
|
180 |
+
background-size: cover; /* or 'contain' based on your preference */
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
.loading-icon {
|
185 |
+
display: none;
|
186 |
+
border: 4px solid #f3f3f3;
|
187 |
+
border-top: 4px solid #3498db;
|
188 |
+
border-radius: 50%;
|
189 |
+
width: 20px;
|
190 |
+
height: 20px;
|
191 |
+
animation: spin 1s linear infinite;
|
192 |
+
}
|
193 |
+
|
194 |
+
@keyframes spin {
|
195 |
+
0% { transform: rotate(0deg); }
|
196 |
+
100% { transform: rotate(360deg); }
|
197 |
+
}
|
models/card/static/card.js
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
document.addEventListener("DOMContentLoaded", function () {
|
2 |
+
const form = document.getElementById("uploadForm");
|
3 |
+
const fileInput = document.getElementById("fileInput");
|
4 |
+
const imagePreview = document.getElementById("imagePreview");
|
5 |
+
const predictButton = document.getElementById("predictButton");
|
6 |
+
const loadingIcon = document.getElementById("loadingIcon");
|
7 |
+
|
8 |
+
form.addEventListener("submit", function (event) {
|
9 |
+
event.preventDefault();
|
10 |
+
|
11 |
+
// Show loading icon and change button text
|
12 |
+
loadingIcon.style.display = "inline-block";
|
13 |
+
predictButton.innerHTML = '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Predicting...';
|
14 |
+
|
15 |
+
const formData = new FormData(form);
|
16 |
+
fetch("/predict_card", {
|
17 |
+
method: "POST",
|
18 |
+
body: formData,
|
19 |
+
})
|
20 |
+
.then(response => response.json())
|
21 |
+
.then(data => {
|
22 |
+
// Hide loading icon and reset button text
|
23 |
+
loadingIcon.style.display = "none";
|
24 |
+
predictButton.innerHTML = 'Predict';
|
25 |
+
|
26 |
+
displayPredictionResult(data);
|
27 |
+
})
|
28 |
+
.catch(error => {
|
29 |
+
// Hide loading icon in case of error and reset button text
|
30 |
+
loadingIcon.style.display = "none";
|
31 |
+
predictButton.innerHTML = 'Predict';
|
32 |
+
|
33 |
+
console.error("Error:", error);
|
34 |
+
});
|
35 |
+
});
|
36 |
+
|
37 |
+
// Image preview on file input change
|
38 |
+
fileInput.addEventListener("change", function () {
|
39 |
+
const file = fileInput.files[0];
|
40 |
+
if (file) {
|
41 |
+
displayImagePreview(file);
|
42 |
+
}
|
43 |
+
});
|
44 |
+
});
|
45 |
+
|
46 |
+
function displayPredictionResult(data) {
|
47 |
+
const resultDiv = document.getElementById("predictionResult");
|
48 |
+
if (data.confidence < 75) {
|
49 |
+
alert("Please upload a valid or clear image.");
|
50 |
+
} else {
|
51 |
+
resultDiv.innerHTML = `
|
52 |
+
<p>Predicted: ${data.class}</p>
|
53 |
+
<p>Confidence: ${data.confidence}%</p>
|
54 |
+
`;
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
function displayImagePreview(file) {
|
59 |
+
const imagePreview = document.getElementById("imagePreview");
|
60 |
+
const imagePreviewContainer = document.getElementById("imagePreviewContainer");
|
61 |
+
|
62 |
+
const reader = new FileReader();
|
63 |
+
reader.onload = function (e) {
|
64 |
+
imagePreview.src = e.target.result;
|
65 |
+
};
|
66 |
+
|
67 |
+
reader.readAsDataURL(file);
|
68 |
+
imagePreviewContainer.style.display = "block";
|
69 |
+
}
|
models/card/static/images/bg1.webp
ADDED
models/card/static/images/bg2.jpg
ADDED
models/chess/chess.html
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- chess.html -->
|
2 |
+
|
3 |
+
<!DOCTYPE html>
|
4 |
+
<html lang="en">
|
5 |
+
<head>
|
6 |
+
<meta charset="UTF-8">
|
7 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
8 |
+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
9 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
10 |
+
<link rel="stylesheet" href="static/chess.css?v=2">
|
11 |
+
<title>Chess Pieces Detection</title>
|
12 |
+
</head>
|
13 |
+
<body>
|
14 |
+
<div class="header-container container">
|
15 |
+
<h1>Chess Pieces Detection</h1>
|
16 |
+
</div>
|
17 |
+
<form id="uploadForm" action="/predict" method="post" enctype="multipart/form-data" class="container">
|
18 |
+
<div id="fileInputContainer">
|
19 |
+
<input type="file" name="file" id="fileInput" accept="image/*">
|
20 |
+
<label for="fileInput" id="fileInputLabel">
|
21 |
+
<i class="fas fa-cloud-upload-alt upload-icon"></i>
|
22 |
+
Drag & Drop or Click to Upload
|
23 |
+
</label>
|
24 |
+
</div>
|
25 |
+
<div id="imageContainer" class="container">
|
26 |
+
<img id="imagePreview">
|
27 |
+
</div>
|
28 |
+
<div id="predictionResult" class="container"></div>
|
29 |
+
<button type="submit" class="predict-btn" id="predictButton">
|
30 |
+
<span class="loading-icon" id="loadingIcon"></span>
|
31 |
+
Predict
|
32 |
+
</button>
|
33 |
+
</form>
|
34 |
+
<script src="static/chess.js"></script>
|
35 |
+
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
36 |
+
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js"></script>
|
37 |
+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
38 |
+
</body>
|
39 |
+
</html>
|
models/chess/chess_prediction_v4.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:68f9536e37e91ea627b6d220c5889770590c54c0b5b69f5b9ce7b21253a6f619
|
3 |
+
size 10037240
|
models/chess/static/chess.css
ADDED
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* style.css */
|
2 |
+
|
3 |
+
body, html {
|
4 |
+
margin: 0;
|
5 |
+
padding: 0;
|
6 |
+
height: 100%;
|
7 |
+
}
|
8 |
+
|
9 |
+
body {
|
10 |
+
background-image: url('images/bg1.jpg');
|
11 |
+
background-size: cover;
|
12 |
+
background-position: center;
|
13 |
+
background-repeat: no-repeat;
|
14 |
+
font-family: 'Arial', sans-serif;
|
15 |
+
color: #333;
|
16 |
+
overflow-y: scroll;
|
17 |
+
background-attachment: fixed;
|
18 |
+
}
|
19 |
+
|
20 |
+
.container {
|
21 |
+
max-width: 600px; /* Adjust the max-width as needed */
|
22 |
+
margin: 20px auto;
|
23 |
+
padding: 20px;
|
24 |
+
border-radius: 8px;
|
25 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
|
26 |
+
backdrop-filter: blur(0px);
|
27 |
+
}
|
28 |
+
|
29 |
+
.header-container {
|
30 |
+
max-width: 600px;
|
31 |
+
margin: 0 auto;
|
32 |
+
background-color: ##f4d03f;/* Adjust the alpha value for transparency */
|
33 |
+
border-radius: 8px;
|
34 |
+
padding: 20px;
|
35 |
+
border: 1px solid ##3498db;
|
36 |
+
border-radius: 10px;
|
37 |
+
text-align: center;
|
38 |
+
margin-bottom: 20px;
|
39 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 6);
|
40 |
+
backdrop-filter: blur(0px);
|
41 |
+
margin: 20px auto 0
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
h1 {
|
46 |
+
text-align: center;
|
47 |
+
color: rgb(255, 255, 255);
|
48 |
+
font-weight: bold;
|
49 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 8);
|
50 |
+
margin: 0;
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
+
#fileInputContainer {
|
55 |
+
position: relative;
|
56 |
+
margin-bottom: 20px;
|
57 |
+
|
58 |
+
|
59 |
+
}
|
60 |
+
|
61 |
+
#fileInput {
|
62 |
+
position: absolute;
|
63 |
+
top: 0;
|
64 |
+
left: 0;
|
65 |
+
width: 100%;
|
66 |
+
height: 100%;
|
67 |
+
opacity: 0;
|
68 |
+
cursor: pointer;
|
69 |
+
backdrop-filter: blur(0px);
|
70 |
+
border-radius: 8px;
|
71 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
|
72 |
+
}
|
73 |
+
|
74 |
+
#fileInputLabel {
|
75 |
+
display: flex;
|
76 |
+
flex-direction: column;
|
77 |
+
align-items: center;
|
78 |
+
justify-content: center;
|
79 |
+
font-size: 18px;
|
80 |
+
color: #ffd903;
|
81 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 2);
|
82 |
+
font-weight: bold;
|
83 |
+
cursor: pointer;
|
84 |
+
transition: color 0.3s ease;
|
85 |
+
}
|
86 |
+
|
87 |
+
#fileInputLabel:hover {
|
88 |
+
color: #297fb8;
|
89 |
+
}
|
90 |
+
|
91 |
+
#imagePreview {
|
92 |
+
max-width: 100%;
|
93 |
+
height: auto;
|
94 |
+
border: 0px solid #ddd;
|
95 |
+
border-radius: 8px;
|
96 |
+
padding: 10px;
|
97 |
+
backdrop-filter: blur(50px);
|
98 |
+
margin-bottom: 20px;
|
99 |
+
display: block;
|
100 |
+
margin: 0 auto;
|
101 |
+
}
|
102 |
+
#imageContainer {
|
103 |
+
text-align: center;
|
104 |
+
backdrop-filter: blur(10px); /* Adjust the blur value as needed */
|
105 |
+
|
106 |
+
border-radius: 8px;
|
107 |
+
padding: 10px;
|
108 |
+
margin-bottom: 20px;
|
109 |
+
display: block;
|
110 |
+
margin: 0 auto;
|
111 |
+
}
|
112 |
+
|
113 |
+
.upload-icon {
|
114 |
+
font-size: 36px;
|
115 |
+
margin-bottom: 10px;
|
116 |
+
}
|
117 |
+
|
118 |
+
.predict-btn {
|
119 |
+
width: 100%;
|
120 |
+
padding: 10px;
|
121 |
+
background-color:rgb(159, 172, 41);
|
122 |
+
color:white;
|
123 |
+
font-weight: bold;
|
124 |
+
border: none;
|
125 |
+
border-radius: 50px;
|
126 |
+
cursor: pointer;
|
127 |
+
transition: background-color 0.3s;
|
128 |
+
}
|
129 |
+
|
130 |
+
.predict-btn:hover {
|
131 |
+
background-color: #0c8b30;
|
132 |
+
letter-spacing: 2px;
|
133 |
+
box-shadow: #0c8b30 0px 7px 29px 0px;
|
134 |
+
}
|
135 |
+
|
136 |
+
.predict-btn:active {
|
137 |
+
background-color: #0c8b30;
|
138 |
+
letter-spacing: 2px;
|
139 |
+
box-shadow: #0c8b30 0px 7px 29px 0px;
|
140 |
+
transform: translateY(10px);
|
141 |
+
}
|
142 |
+
.predict-btn:focus {
|
143 |
+
outline: none;
|
144 |
+
}
|
145 |
+
|
146 |
+
#predictionResult {
|
147 |
+
color: white; /* Change the color to white */
|
148 |
+
margin-top: 20px;
|
149 |
+
text-align: center;
|
150 |
+
backdrop-filter: blur(0px);
|
151 |
+
font-weight: bold;
|
152 |
+
border: none;
|
153 |
+
box-shadow: none;
|
154 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 2);
|
155 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9)
|
156 |
+
box-shadow: none;
|
157 |
+
}
|
158 |
+
|
159 |
+
@media only screen and (max-width: 600px) {
|
160 |
+
h1{
|
161 |
+
font-size:25px;
|
162 |
+
font-family: 'Kanit', sans-serif;
|
163 |
+
}
|
164 |
+
#imagePreview {
|
165 |
+
max-width: 70%;
|
166 |
+
height: 60%;
|
167 |
+
border: 0px solid #ddd;
|
168 |
+
border-radius: 8px;
|
169 |
+
padding: 10px;
|
170 |
+
backdrop-filter: blur(50px);
|
171 |
+
margin-bottom: 10px;
|
172 |
+
display: block;
|
173 |
+
margin: 0 auto;
|
174 |
+
}
|
175 |
+
body {
|
176 |
+
background-size: cover; /* or 'contain' based on your preference */
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
.loading-icon {
|
181 |
+
display: none;
|
182 |
+
border: 4px solid #f3f3f3;
|
183 |
+
border-top: 4px solid #3498db;
|
184 |
+
border-radius: 50%;
|
185 |
+
width: 20px;
|
186 |
+
height: 20px;
|
187 |
+
animation: spin 1s linear infinite;
|
188 |
+
}
|
189 |
+
|
190 |
+
@keyframes spin {
|
191 |
+
0% { transform: rotate(0deg); }
|
192 |
+
100% { transform: rotate(360deg); }
|
193 |
+
}
|
models/chess/static/chess.js
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
document.addEventListener("DOMContentLoaded", function () {
|
2 |
+
const form = document.getElementById("uploadForm");
|
3 |
+
const fileInput = document.getElementById("fileInput");
|
4 |
+
const predictButton = document.getElementById("predictButton");
|
5 |
+
const loadingIcon = document.getElementById("loadingIcon");
|
6 |
+
|
7 |
+
form.addEventListener("submit", function (event) {
|
8 |
+
event.preventDefault();
|
9 |
+
|
10 |
+
// Show loading icon and change button text
|
11 |
+
loadingIcon.style.display = "inline-block";
|
12 |
+
predictButton.innerHTML = '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Predicting...';
|
13 |
+
|
14 |
+
const formData = new FormData(form);
|
15 |
+
fetch("/predict_chess", {
|
16 |
+
method: "POST",
|
17 |
+
body: formData,
|
18 |
+
})
|
19 |
+
.then(response => response.json())
|
20 |
+
.then(data => {
|
21 |
+
// Hide loading icon and reset button text
|
22 |
+
loadingIcon.style.display = "none";
|
23 |
+
predictButton.innerHTML = 'Predict';
|
24 |
+
|
25 |
+
displayPredictionResult(data);
|
26 |
+
})
|
27 |
+
.catch(error => {
|
28 |
+
// Hide loading icon in case of error and reset button text
|
29 |
+
loadingIcon.style.display = "none";
|
30 |
+
predictButton.innerHTML = 'Predict';
|
31 |
+
|
32 |
+
console.error("Error:", error);
|
33 |
+
});
|
34 |
+
});
|
35 |
+
|
36 |
+
// Image preview on file input change
|
37 |
+
fileInput.addEventListener("change", function () {
|
38 |
+
const file = fileInput.files[0];
|
39 |
+
if (file) {
|
40 |
+
displayImagePreview(file);
|
41 |
+
}
|
42 |
+
});
|
43 |
+
});
|
44 |
+
|
45 |
+
function displayPredictionResult(data) {
|
46 |
+
const resultDiv = document.getElementById("predictionResult");
|
47 |
+
if (data.confidence < 75) {
|
48 |
+
alert("Please upload a valid or clear image.");
|
49 |
+
} else {
|
50 |
+
resultDiv.innerHTML = `
|
51 |
+
<p>Predicted: ${data.class}</p>
|
52 |
+
<p>Confidence: ${data.confidence}%</p>
|
53 |
+
`;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
function displayImagePreview(file) {
|
58 |
+
const imagePreview = document.getElementById("imagePreview");
|
59 |
+
const imagePreviewContainer = document.getElementById("imagePreviewContainer");
|
60 |
+
|
61 |
+
const reader = new FileReader();
|
62 |
+
reader.onload = function (e) {
|
63 |
+
imagePreview.src = e.target.result;
|
64 |
+
};
|
65 |
+
|
66 |
+
reader.readAsDataURL(file);
|
67 |
+
imagePreviewContainer.style.display = "block";
|
68 |
+
}
|
models/chess/static/images/bg1.jpg
ADDED
Git LFS Details
|
models/chess/static/images/bg2.jpg
ADDED
Git LFS Details
|
models/dog_breed/dog_breed.html
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
7 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
8 |
+
<link rel="stylesheet" href="static/dog_breed.css?v=1">
|
9 |
+
<title>Dog Breed Prediction</title>
|
10 |
+
</head>
|
11 |
+
<body>
|
12 |
+
<div class="header-container container">
|
13 |
+
<h1>Dog Breed Prediction</h1>
|
14 |
+
</div>
|
15 |
+
<form id="uploadForm" action="/predict" method="post" enctype="multipart/form-data" class="container">
|
16 |
+
<div id="fileInputContainer">
|
17 |
+
<input type="file" name="file" id="fileInput" accept="image/*">
|
18 |
+
<label for="fileInput" id="fileInputLabel">
|
19 |
+
<i class="fas fa-cloud-upload-alt upload-icon"></i>
|
20 |
+
Drag & Drop or Click to Upload
|
21 |
+
</label>
|
22 |
+
</div>
|
23 |
+
<div id="predictionResult" class="container"></div>
|
24 |
+
<button type="submit" class="predict-btn" id="predictButton">
|
25 |
+
<span class="loading-icon" id="loadingIcon"></span>
|
26 |
+
Predict
|
27 |
+
</button>
|
28 |
+
</form>
|
29 |
+
<script src="static/dog_breed.js"></script>
|
30 |
+
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
31 |
+
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js"></script>
|
32 |
+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
33 |
+
</body>
|
34 |
+
</html>
|
models/dog_breed/dog_breedv3.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e7cfc1bdd19cd80871d5dfb2d0458131538566b8a4e1a4506ef0dd43c90b3d78
|
3 |
+
size 12796128
|
models/dog_breed/static/dog_breed.css
ADDED
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* style.css */
|
2 |
+
|
3 |
+
body, html {
|
4 |
+
margin: 0;
|
5 |
+
padding: 0;
|
6 |
+
height: 100%;
|
7 |
+
}
|
8 |
+
|
9 |
+
body {
|
10 |
+
background-image: url('images/bg2.jpg');
|
11 |
+
background-size: cover;
|
12 |
+
background-position: center;
|
13 |
+
background-repeat: no-repeat;
|
14 |
+
font-family: 'Arial', sans-serif;
|
15 |
+
color: #333;
|
16 |
+
overflow-y: scroll;
|
17 |
+
background-attachment: fixed;
|
18 |
+
}
|
19 |
+
|
20 |
+
.container {
|
21 |
+
max-width: 600px; /* Adjust the max-width as needed */
|
22 |
+
margin: 20px auto;
|
23 |
+
padding: 20px;
|
24 |
+
border-radius: 8px;
|
25 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
|
26 |
+
backdrop-filter: blur(0px);
|
27 |
+
}
|
28 |
+
|
29 |
+
.header-container {
|
30 |
+
max-width: 600px;
|
31 |
+
margin: 0 auto;
|
32 |
+
border-radius: 8px;
|
33 |
+
padding: 20px;
|
34 |
+
border-radius: 10px;
|
35 |
+
text-align: center;
|
36 |
+
margin-bottom: 20px;
|
37 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 6);
|
38 |
+
backdrop-filter: blur(10px);
|
39 |
+
margin: 20px auto 0;
|
40 |
+
}
|
41 |
+
|
42 |
+
|
43 |
+
h1 {
|
44 |
+
text-align: center;
|
45 |
+
color: rgb(104, 80, 80);
|
46 |
+
font-weight: bold;
|
47 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 20);
|
48 |
+
margin: 0;
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
+
#fileInputContainer {
|
53 |
+
position: relative;
|
54 |
+
margin-bottom: 20px;
|
55 |
+
border: none;
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
#fileInput {
|
60 |
+
position: absolute;
|
61 |
+
top: 0;
|
62 |
+
left: 0;
|
63 |
+
width: 100%;
|
64 |
+
height: 100%;
|
65 |
+
opacity: 0;
|
66 |
+
cursor: pointer;
|
67 |
+
backdrop-filter: blur(0px);
|
68 |
+
border-radius: 8px;
|
69 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
|
70 |
+
}
|
71 |
+
|
72 |
+
#fileInputLabel {
|
73 |
+
display: flex;
|
74 |
+
flex-direction: column;
|
75 |
+
align-items: center;
|
76 |
+
justify-content: center;
|
77 |
+
font-size: 18px;
|
78 |
+
color: #989e2a;
|
79 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
|
80 |
+
font-weight: bold;
|
81 |
+
cursor: pointer;
|
82 |
+
transition: color 0.3s ease;
|
83 |
+
}
|
84 |
+
|
85 |
+
#fileInputLabel:hover {
|
86 |
+
color: #297fb8;
|
87 |
+
}
|
88 |
+
|
89 |
+
#imagePreview {
|
90 |
+
max-width: 100%;
|
91 |
+
height: auto;
|
92 |
+
border: 0px solid #ddd;
|
93 |
+
border-radius: 8px;
|
94 |
+
padding: 10px;
|
95 |
+
backdrop-filter: blur(50px);
|
96 |
+
margin-bottom: 20px;
|
97 |
+
display: block;
|
98 |
+
margin: 0 auto;
|
99 |
+
}
|
100 |
+
#imageContainer {
|
101 |
+
text-align: center;
|
102 |
+
backdrop-filter: blur(10px); /* Adjust the blur value as needed */
|
103 |
+
background-color: rgba(255, 255, 255, 0.5); /* Adjust the alpha value for transparency */
|
104 |
+
border-radius: 8px;
|
105 |
+
padding: 10px;
|
106 |
+
margin-bottom: 20px;
|
107 |
+
display: block;
|
108 |
+
margin: 0 auto;
|
109 |
+
}
|
110 |
+
|
111 |
+
.upload-icon {
|
112 |
+
font-size: 36px;
|
113 |
+
margin-bottom: 10px;
|
114 |
+
}
|
115 |
+
|
116 |
+
.predict-btn {
|
117 |
+
width: 100%;
|
118 |
+
padding: 10px;
|
119 |
+
background-color:rgb(72, 59, 59);
|
120 |
+
color:white;
|
121 |
+
font-weight: bold;
|
122 |
+
border: none;
|
123 |
+
border-radius: 50px;
|
124 |
+
cursor: pointer;
|
125 |
+
transition: background-color 0.3s;
|
126 |
+
}
|
127 |
+
|
128 |
+
.predict-btn:hover {
|
129 |
+
background-color: #000000;
|
130 |
+
letter-spacing: 2px;
|
131 |
+
box-shadow: #000000; 0px 7px 29px 0px;
|
132 |
+
}
|
133 |
+
|
134 |
+
.predict-btn:active {
|
135 |
+
background-color: #000000;
|
136 |
+
letter-spacing: 2px;
|
137 |
+
box-shadow: #000000; 0px 7px 29px 0px;
|
138 |
+
transform: translateY(10px);
|
139 |
+
}
|
140 |
+
.predict-btn:focus {
|
141 |
+
outline: none;
|
142 |
+
}
|
143 |
+
|
144 |
+
#predictionResult {
|
145 |
+
color: white; /* Change the color to white */
|
146 |
+
margin-top: 20px;
|
147 |
+
text-align: center;
|
148 |
+
backdrop-filter: blur(40px);
|
149 |
+
font-weight: bold;
|
150 |
+
border: none;
|
151 |
+
font-size: 20px;
|
152 |
+
font-family: 'Kanit', sans-serif;
|
153 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
|
154 |
+
box-shadow: none;
|
155 |
+
}
|
156 |
+
|
157 |
+
@media only screen and (max-width: 600px) {
|
158 |
+
h1{
|
159 |
+
font-size:25px;
|
160 |
+
font-family: 'Kanit', sans-serif;
|
161 |
+
}
|
162 |
+
#imagePreview {
|
163 |
+
max-width: 70%;
|
164 |
+
height: 60%;
|
165 |
+
border: 0px solid #ddd;
|
166 |
+
border-radius: 8px;
|
167 |
+
padding: 10px;
|
168 |
+
backdrop-filter: blur(50px);
|
169 |
+
margin-bottom: 10px;
|
170 |
+
display: block;
|
171 |
+
margin: 0 auto;
|
172 |
+
}
|
173 |
+
body {
|
174 |
+
background-size: cover; /* or 'contain' based on your preference */
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
.loading-icon {
|
179 |
+
display: none;
|
180 |
+
border: 4px solid #f3f3f3;
|
181 |
+
border-top: 4px solid #3498db;
|
182 |
+
border-radius: 50%;
|
183 |
+
width: 20px;
|
184 |
+
height: 20px;
|
185 |
+
animation: spin 1s linear infinite;
|
186 |
+
}
|
187 |
+
|
188 |
+
@keyframes spin {
|
189 |
+
0% { transform: rotate(0deg); }
|
190 |
+
100% { transform: rotate(360deg); }
|
191 |
+
}
|
models/dog_breed/static/dog_breed.js
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
document.addEventListener("DOMContentLoaded", function () {
|
2 |
+
const form = document.getElementById("uploadForm");
|
3 |
+
const fileInput = document.getElementById("fileInput");
|
4 |
+
const predictButton = document.getElementById("predictButton");
|
5 |
+
const loadingIcon = document.getElementById("loadingIcon");
|
6 |
+
|
7 |
+
form.addEventListener("submit", function (event) {
|
8 |
+
event.preventDefault();
|
9 |
+
|
10 |
+
// Show loading icon and change button text
|
11 |
+
loadingIcon.style.display = "inline-block";
|
12 |
+
predictButton.innerHTML = '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Predicting...';
|
13 |
+
|
14 |
+
const formData = new FormData(form);
|
15 |
+
fetch("/predict_dog_breed", {
|
16 |
+
method: "POST",
|
17 |
+
body: formData,
|
18 |
+
})
|
19 |
+
.then(response => response.json())
|
20 |
+
.then(data => {
|
21 |
+
// Hide loading icon and reset button text
|
22 |
+
loadingIcon.style.display = "none";
|
23 |
+
predictButton.innerHTML = 'Predict';
|
24 |
+
|
25 |
+
displayPredictionResult(data);
|
26 |
+
})
|
27 |
+
.catch(error => {
|
28 |
+
// Hide loading icon in case of error and reset button text
|
29 |
+
loadingIcon.style.display = "none";
|
30 |
+
predictButton.innerHTML = 'Predict';
|
31 |
+
|
32 |
+
console.error("Error:", error);
|
33 |
+
});
|
34 |
+
});
|
35 |
+
|
36 |
+
// Image preview on file input change
|
37 |
+
fileInput.addEventListener("change", function () {
|
38 |
+
const file = fileInput.files[0];
|
39 |
+
if (file) {
|
40 |
+
displayImagePreview(file);
|
41 |
+
}
|
42 |
+
});
|
43 |
+
});
|
44 |
+
|
45 |
+
function displayPredictionResult(data) {
|
46 |
+
const resultDiv = document.getElementById("predictionResult");
|
47 |
+
if (data.confidence < 75) {
|
48 |
+
alert("Please upload a valid or clear image.");
|
49 |
+
} else {
|
50 |
+
resultDiv.innerHTML = `
|
51 |
+
<p>Predicted: ${data.class}</p>
|
52 |
+
<p>Confidence: ${data.confidence}%</p>
|
53 |
+
`;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
function displayImagePreview(file) {
|
58 |
+
const body = document.body;
|
59 |
+
|
60 |
+
const reader = new FileReader();
|
61 |
+
reader.onload = function (e) {
|
62 |
+
// Set the background image of the body to the dropped image
|
63 |
+
body.style.backgroundImage = `url(${e.target.result})`;
|
64 |
+
body.style.backgroundSize = "cover";
|
65 |
+
body.style.backgroundPosition = "center";
|
66 |
+
body.style.backgroundRepeat = "no-repeat";
|
67 |
+
};
|
68 |
+
|
69 |
+
reader.readAsDataURL(file);
|
70 |
+
}
|
models/dog_breed/static/images/bg1.jpg
ADDED
models/dog_breed/static/images/bg2.jpg
ADDED
models/flower/flower.html
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
7 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
8 |
+
<link rel="stylesheet" href="./static/flower.css?v=1">
|
9 |
+
<title>Flower Classification</title>
|
10 |
+
</head>
|
11 |
+
<body>
|
12 |
+
<div class="header-container container">
|
13 |
+
<h1>Flower Classification</h1>
|
14 |
+
</div>
|
15 |
+
<form id="uploadForm" action="/predict" method="post" enctype="multipart/form-data" class="container">
|
16 |
+
<div id="fileInputContainer">
|
17 |
+
<input type="file" name="file" id="fileInput" accept="image/*">
|
18 |
+
<label for="fileInput" id="fileInputLabel">
|
19 |
+
<i class="fas fa-cloud-upload-alt upload-icon"></i>
|
20 |
+
Drag & Drop or Click to Upload
|
21 |
+
</label>
|
22 |
+
</div>
|
23 |
+
<div id="predictionResult" class="container"></div>
|
24 |
+
<button type="submit" class="predict-btn" id="predictButton">
|
25 |
+
<span class="loading-icon" id="loadingIcon"></span>
|
26 |
+
Predict
|
27 |
+
</button>
|
28 |
+
</form>
|
29 |
+
<script src="static/flower.js"></script>
|
30 |
+
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
31 |
+
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js"></script>
|
32 |
+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
33 |
+
</body>
|
34 |
+
</html>
|
models/flower/flower_prediction.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a8419d99dab25f5d565ecd08045c94baa618017551d86b0827d22d74d44fc42c
|
3 |
+
size 97987968
|
models/flower/static/flower.css
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* style.css */
|
2 |
+
|
3 |
+
body, html {
|
4 |
+
margin: 0;
|
5 |
+
padding: 0;
|
6 |
+
height: 100%;
|
7 |
+
}
|
8 |
+
|
9 |
+
body {
|
10 |
+
background-image: url('images/bg2.jpg');
|
11 |
+
background-size: cover;
|
12 |
+
background-position: center;
|
13 |
+
background-repeat: no-repeat;
|
14 |
+
font-family: 'Arial', sans-serif;
|
15 |
+
color: #333;
|
16 |
+
overflow-y: scroll;
|
17 |
+
background-attachment: fixed;
|
18 |
+
}
|
19 |
+
|
20 |
+
.container {
|
21 |
+
max-width: 600px; /* Adjust the max-width as needed */
|
22 |
+
margin: 20px auto;
|
23 |
+
padding: 20px;
|
24 |
+
border-radius: 8px;
|
25 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
|
26 |
+
backdrop-filter: blur(0px);
|
27 |
+
}
|
28 |
+
|
29 |
+
.header-container {
|
30 |
+
max-width: 600px;
|
31 |
+
margin: 0 auto;
|
32 |
+
border-radius: 8px;
|
33 |
+
padding: 20px;
|
34 |
+
border-radius: 10px;
|
35 |
+
text-align: center;
|
36 |
+
margin-bottom: 20px;
|
37 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
|
38 |
+
backdrop-filter: blur(0px);
|
39 |
+
margin: 20px auto 0
|
40 |
+
}
|
41 |
+
|
42 |
+
|
43 |
+
h1 {
|
44 |
+
text-align: center;
|
45 |
+
color: rgb(176, 37, 181);
|
46 |
+
font-weight: bold;
|
47 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
|
48 |
+
margin: 0;
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
+
#fileInputContainer {
|
53 |
+
position: relative;
|
54 |
+
margin-bottom: 20px;
|
55 |
+
}
|
56 |
+
|
57 |
+
#fileInput {
|
58 |
+
position: absolute;
|
59 |
+
top: 0;
|
60 |
+
left: 0;
|
61 |
+
width: 100%;
|
62 |
+
height: 100%;
|
63 |
+
opacity: 0;
|
64 |
+
cursor: pointer;
|
65 |
+
backdrop-filter: blur(0px);
|
66 |
+
border-radius: 8px;
|
67 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
|
68 |
+
}
|
69 |
+
|
70 |
+
#fileInputLabel {
|
71 |
+
display: flex;
|
72 |
+
flex-direction: column;
|
73 |
+
align-items: center;
|
74 |
+
justify-content: center;
|
75 |
+
font-size: 18px;
|
76 |
+
color: rgb(176, 37, 181);
|
77 |
+
font-weight: bold;
|
78 |
+
cursor: pointer;
|
79 |
+
transition: color 0.3s ease;
|
80 |
+
}
|
81 |
+
|
82 |
+
#fileInput :hover {
|
83 |
+
color: #297fb8;
|
84 |
+
letter-spacing: 2px;
|
85 |
+
box-shadow: #2c96ba 0px 7px 29px 0px;
|
86 |
+
outline: none;
|
87 |
+
}
|
88 |
+
|
89 |
+
#imagePreview {
|
90 |
+
max-width: 100%;
|
91 |
+
height: auto;
|
92 |
+
border: 0px solid #ddd;
|
93 |
+
border-radius: 8px;
|
94 |
+
padding: 10px;
|
95 |
+
border: rgb(0, 0, 0, 0.5);
|
96 |
+
backdrop-filter: blur(50px);
|
97 |
+
margin-bottom: 20px;
|
98 |
+
display: block;
|
99 |
+
margin: 0 auto;
|
100 |
+
}
|
101 |
+
#imageContainer {
|
102 |
+
text-align: center;
|
103 |
+
backdrop-filter: blur(10px); /* Adjust the blur value as needed */
|
104 |
+
border-radius: 8px;
|
105 |
+
padding: 10px;
|
106 |
+
margin-bottom: 20px;
|
107 |
+
display: block;
|
108 |
+
margin: 0 auto;
|
109 |
+
}
|
110 |
+
|
111 |
+
.upload-icon {
|
112 |
+
font-size: 36px;
|
113 |
+
margin-bottom: 10px;
|
114 |
+
}
|
115 |
+
|
116 |
+
.predict-btn {
|
117 |
+
width: 100%;
|
118 |
+
padding: 10px;
|
119 |
+
background-color:rgb(176, 37, 181);
|
120 |
+
color:white;
|
121 |
+
font-weight: bold;
|
122 |
+
border: none;
|
123 |
+
border-radius: 50px;
|
124 |
+
cursor: pointer;
|
125 |
+
transition: background-color 0.2s;
|
126 |
+
}
|
127 |
+
|
128 |
+
.predict-btn:hover {
|
129 |
+
background-color: #2c96ba;
|
130 |
+
letter-spacing: 2px;
|
131 |
+
box-shadow: #2c96ba 0px 7px 29px 0px;
|
132 |
+
}
|
133 |
+
|
134 |
+
.predict-btn:active {
|
135 |
+
background-color: #2c96ba;
|
136 |
+
letter-spacing: 2px;
|
137 |
+
box-shadow: #2c96ba 0px 7px 29px 0px;
|
138 |
+
transform: translateY(10px);
|
139 |
+
}
|
140 |
+
.predict-btn:focus {
|
141 |
+
outline: none;
|
142 |
+
}
|
143 |
+
|
144 |
+
#predictionResult {
|
145 |
+
color: black; /* Change the color to white */
|
146 |
+
background-color:rgb(234, 240, 239, 0.3);
|
147 |
+
margin-top: 20px;
|
148 |
+
text-align: center;
|
149 |
+
backdrop-filter: blur(0px);
|
150 |
+
font-weight: bold;
|
151 |
+
border: none;
|
152 |
+
box-shadow: none;
|
153 |
+
}
|
154 |
+
|
155 |
+
@media only screen and (max-width: 600px) {
|
156 |
+
h1{
|
157 |
+
font-size:25px;
|
158 |
+
font-family: 'Kanit', sans-serif;
|
159 |
+
}
|
160 |
+
#imagePreview {
|
161 |
+
max-width: 70%;
|
162 |
+
height: 60%;
|
163 |
+
border: 0px solid #ddd;
|
164 |
+
border-radius: 8px;
|
165 |
+
padding: 10px;
|
166 |
+
backdrop-filter: blur(50px);
|
167 |
+
margin-bottom: 10px;
|
168 |
+
display: block;
|
169 |
+
margin: 0 auto;
|
170 |
+
}
|
171 |
+
body {
|
172 |
+
background-size: cover; /* or 'contain' based on your preference */
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
.loading-icon {
|
177 |
+
display: none;
|
178 |
+
border: 4px solid #f3f3f3;
|
179 |
+
border-top: 4px solid #3498db;
|
180 |
+
border-radius: 50%;
|
181 |
+
width: 20px;
|
182 |
+
height: 20px;
|
183 |
+
animation: spin 1s linear infinite;
|
184 |
+
}
|
185 |
+
|
186 |
+
@keyframes spin {
|
187 |
+
0% { transform: rotate(0deg); }
|
188 |
+
100% { transform: rotate(360deg); }
|
189 |
+
}
|
models/flower/static/flower.js
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
document.addEventListener("DOMContentLoaded", function () {
|
2 |
+
const form = document.getElementById("uploadForm");
|
3 |
+
const fileInput = document.getElementById("fileInput");
|
4 |
+
const predictButton = document.getElementById("predictButton");
|
5 |
+
const loadingIcon = document.getElementById("loadingIcon");
|
6 |
+
|
7 |
+
form.addEventListener("submit", function (event) {
|
8 |
+
event.preventDefault();
|
9 |
+
|
10 |
+
// Show loading icon and change button text
|
11 |
+
loadingIcon.style.display = "inline-block";
|
12 |
+
predictButton.innerHTML = '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Predicting...';
|
13 |
+
|
14 |
+
const formData = new FormData(form);
|
15 |
+
fetch("/predict_flower", {
|
16 |
+
method: "POST",
|
17 |
+
body: formData,
|
18 |
+
})
|
19 |
+
.then(response => response.json())
|
20 |
+
.then(data => {
|
21 |
+
// Hide loading icon and reset button text
|
22 |
+
loadingIcon.style.display = "none";
|
23 |
+
predictButton.innerHTML = 'Predict';
|
24 |
+
|
25 |
+
displayPredictionResult(data);
|
26 |
+
})
|
27 |
+
.catch(error => {
|
28 |
+
// Hide loading icon in case of error and reset button text
|
29 |
+
loadingIcon.style.display = "none";
|
30 |
+
predictButton.innerHTML = 'Predict';
|
31 |
+
|
32 |
+
console.error("Error:", error);
|
33 |
+
});
|
34 |
+
});
|
35 |
+
|
36 |
+
// Image preview on file input change
|
37 |
+
fileInput.addEventListener("change", function () {
|
38 |
+
const file = fileInput.files[0];
|
39 |
+
if (file) {
|
40 |
+
displayImagePreview(file);
|
41 |
+
}
|
42 |
+
});
|
43 |
+
});
|
44 |
+
|
45 |
+
function displayPredictionResult(data) {
|
46 |
+
const resultDiv = document.getElementById("predictionResult");
|
47 |
+
if (data.confidence < 75) {
|
48 |
+
alert("Please upload a valid or clear image.");
|
49 |
+
} else {
|
50 |
+
resultDiv.innerHTML = `
|
51 |
+
<p>Predicted: ${data.class}</p>
|
52 |
+
<p>Confidence: ${data.confidence}%</p>
|
53 |
+
`;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
function displayImagePreview(file) {
|
58 |
+
const body = document.body;
|
59 |
+
|
60 |
+
const reader = new FileReader();
|
61 |
+
reader.onload = function (e) {
|
62 |
+
// Set the background image of the body to the dropped image
|
63 |
+
body.style.backgroundImage = `url(${e.target.result})`;
|
64 |
+
body.style.backgroundSize = "cover";
|
65 |
+
body.style.backgroundPosition = "center";
|
66 |
+
body.style.backgroundRepeat = "no-repeat";
|
67 |
+
};
|
68 |
+
|
69 |
+
reader.readAsDataURL(file);
|
70 |
+
}
|
models/flower/static/images/bg1.jpeg
ADDED
models/flower/static/images/bg2.jpg
ADDED
models/mammals/Mammals_predictionv1.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e407122ffe0857b44239f45dd58bf1b92083d77988995e489cc002e60f10450f
|
3 |
+
size 10137360
|
models/mammals/mammals.html
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- mammals.html -->
|
2 |
+
|
3 |
+
<!DOCTYPE html>
|
4 |
+
<html lang="en">
|
5 |
+
<head>
|
6 |
+
<meta charset="UTF-8">
|
7 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
8 |
+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
9 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
10 |
+
<link rel="stylesheet" href="static/mammals.css?v=3">
|
11 |
+
<title>Mammals Classification</title>
|
12 |
+
</head>
|
13 |
+
<body>
|
14 |
+
<div class="header-container container">
|
15 |
+
<h1>Mammals Classification</h1>
|
16 |
+
</div>
|
17 |
+
<form id="uploadForm" action="/predict" method="post" enctype="multipart/form-data" class="container">
|
18 |
+
<div id="fileInputContainer">
|
19 |
+
<input type="file" name="file" id="fileInput" accept="image/*">
|
20 |
+
<label for="fileInput" id="fileInputLabel">
|
21 |
+
<i class="fas fa-cloud-upload-alt upload-icon"></i>
|
22 |
+
Drag & Drop or Click to Upload
|
23 |
+
</label>
|
24 |
+
</div>
|
25 |
+
<div id="imageContainer" class="container">
|
26 |
+
<img id="imagePreview">
|
27 |
+
</div>
|
28 |
+
<div id="predictionResult" class="container"></div>
|
29 |
+
<button type="submit" class="predict-btn" id="predictButton">
|
30 |
+
<span class="loading-icon" id="loadingIcon"></span>
|
31 |
+
Predict
|
32 |
+
</button>
|
33 |
+
</form>
|
34 |
+
<script src="static/mammals.js"></script>
|
35 |
+
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
36 |
+
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js"></script>
|
37 |
+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
38 |
+
</body>
|
39 |
+
</html>
|
models/mammals/static/images/forest image.jpg
ADDED
Git LFS Details
|
models/mammals/static/mammals.css
ADDED
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* style.css */
|
2 |
+
|
3 |
+
body, html {
|
4 |
+
margin: 0;
|
5 |
+
padding: 0;
|
6 |
+
height: 100%;
|
7 |
+
}
|
8 |
+
|
9 |
+
body {
|
10 |
+
background-image: url('images/forest image.jpg');
|
11 |
+
background-size: cover;
|
12 |
+
background-position: center;
|
13 |
+
background-repeat: no-repeat;
|
14 |
+
font-family: 'Arial', sans-serif;
|
15 |
+
color: #333;
|
16 |
+
overflow-y: scroll;
|
17 |
+
background-attachment: fixed;
|
18 |
+
}
|
19 |
+
|
20 |
+
.container {
|
21 |
+
max-width: 600px; /* Adjust the max-width as needed */
|
22 |
+
margin: 20px auto;
|
23 |
+
padding: 20px;
|
24 |
+
border-radius: 8px;
|
25 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
|
26 |
+
backdrop-filter: blur(0px);
|
27 |
+
}
|
28 |
+
|
29 |
+
.header-container {
|
30 |
+
max-width: 600px;
|
31 |
+
margin: 0 auto;
|
32 |
+
background-color: ##f4d03f;/* Adjust the alpha value for transparency */
|
33 |
+
border-radius: 8px;
|
34 |
+
padding: 20px;
|
35 |
+
border: 1px solid ##3498db;
|
36 |
+
border-radius: 10px;
|
37 |
+
text-align: center;
|
38 |
+
margin-bottom: 20px;
|
39 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 6);
|
40 |
+
backdrop-filter: blur(0px);
|
41 |
+
margin: 20px auto 0
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
h1 {
|
46 |
+
text-align: center;
|
47 |
+
color: rgb(255, 255, 255);
|
48 |
+
font-weight: bold;
|
49 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 8);
|
50 |
+
margin: 0;
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
+
#fileInputContainer {
|
55 |
+
position: relative;
|
56 |
+
margin-bottom: 20px;
|
57 |
+
|
58 |
+
|
59 |
+
}
|
60 |
+
|
61 |
+
#fileInput {
|
62 |
+
position: absolute;
|
63 |
+
top: 0;
|
64 |
+
left: 0;
|
65 |
+
width: 100%;
|
66 |
+
height: 100%;
|
67 |
+
opacity: 0;
|
68 |
+
cursor: pointer;
|
69 |
+
backdrop-filter: blur(0px);
|
70 |
+
border-radius: 8px;
|
71 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
|
72 |
+
}
|
73 |
+
|
74 |
+
#fileInputLabel {
|
75 |
+
display: flex;
|
76 |
+
flex-direction: column;
|
77 |
+
align-items: center;
|
78 |
+
justify-content: center;
|
79 |
+
font-size: 18px;
|
80 |
+
color: #ffd903;
|
81 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 2);
|
82 |
+
font-weight: bold;
|
83 |
+
cursor: pointer;
|
84 |
+
transition: color 0.3s ease;
|
85 |
+
}
|
86 |
+
|
87 |
+
#fileInputLabel:hover {
|
88 |
+
color: #297fb8;
|
89 |
+
}
|
90 |
+
|
91 |
+
#imagePreview {
|
92 |
+
max-width: 100%;
|
93 |
+
height: auto;
|
94 |
+
border: 0px solid #ddd;
|
95 |
+
border-radius: 8px;
|
96 |
+
padding: 10px;
|
97 |
+
backdrop-filter: blur(50px);
|
98 |
+
margin-bottom: 20px;
|
99 |
+
display: block;
|
100 |
+
margin: 0 auto;
|
101 |
+
}
|
102 |
+
#imageContainer {
|
103 |
+
text-align: center;
|
104 |
+
backdrop-filter: blur(10px); /* Adjust the blur value as needed */
|
105 |
+
|
106 |
+
border-radius: 8px;
|
107 |
+
padding: 10px;
|
108 |
+
margin-bottom: 20px;
|
109 |
+
display: block;
|
110 |
+
margin: 0 auto;
|
111 |
+
}
|
112 |
+
|
113 |
+
.upload-icon {
|
114 |
+
font-size: 36px;
|
115 |
+
margin-bottom: 10px;
|
116 |
+
}
|
117 |
+
|
118 |
+
.predict-btn {
|
119 |
+
width: 100%;
|
120 |
+
padding: 10px;
|
121 |
+
background-color:rgb(159, 172, 41);
|
122 |
+
color:white;
|
123 |
+
font-weight: bold;
|
124 |
+
border: none;
|
125 |
+
border-radius: 50px;
|
126 |
+
cursor: pointer;
|
127 |
+
transition: background-color 0.3s;
|
128 |
+
}
|
129 |
+
|
130 |
+
.predict-btn:hover {
|
131 |
+
background-color: #0c8b30;
|
132 |
+
letter-spacing: 2px;
|
133 |
+
box-shadow: #0c8b30 0px 7px 29px 0px;
|
134 |
+
}
|
135 |
+
|
136 |
+
.predict-btn:active {
|
137 |
+
background-color: #0c8b30;
|
138 |
+
letter-spacing: 2px;
|
139 |
+
box-shadow: #0c8b30 0px 7px 29px 0px;
|
140 |
+
transform: translateY(10px);
|
141 |
+
}
|
142 |
+
.predict-btn:focus {
|
143 |
+
outline: none;
|
144 |
+
}
|
145 |
+
|
146 |
+
#predictionResult {
|
147 |
+
color: white; /* Change the color to white */
|
148 |
+
margin-top: 20px;
|
149 |
+
text-align: center;
|
150 |
+
backdrop-filter: blur(0px);
|
151 |
+
font-weight: bold;
|
152 |
+
border: none;
|
153 |
+
box-shadow: none;
|
154 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 2);
|
155 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9)
|
156 |
+
box-shadow: none;
|
157 |
+
}
|
158 |
+
|
159 |
+
@media only screen and (max-width: 600px) {
|
160 |
+
h1{
|
161 |
+
font-size:25px;
|
162 |
+
font-family: 'Kanit', sans-serif;
|
163 |
+
}
|
164 |
+
#imagePreview {
|
165 |
+
max-width: 70%;
|
166 |
+
height: 60%;
|
167 |
+
border: 0px solid #ddd;
|
168 |
+
border-radius: 8px;
|
169 |
+
padding: 10px;
|
170 |
+
backdrop-filter: blur(50px);
|
171 |
+
margin-bottom: 10px;
|
172 |
+
display: block;
|
173 |
+
margin: 0 auto;
|
174 |
+
}
|
175 |
+
body {
|
176 |
+
background-size: cover; /* or 'contain' based on your preference */
|
177 |
+
}
|
178 |
+
|
179 |
+
.predict-btn:hover {
|
180 |
+
background-color: rgb(159, 172, 41);
|
181 |
+
letter-spacing: normal;
|
182 |
+
box-shadow: none;
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
.loading-icon {
|
187 |
+
display: none;
|
188 |
+
border: 4px solid #f3f3f3;
|
189 |
+
border-top: 4px solid #3498db;
|
190 |
+
border-radius: 50%;
|
191 |
+
width: 20px;
|
192 |
+
height: 20px;
|
193 |
+
animation: spin 1s linear infinite;
|
194 |
+
}
|
195 |
+
|
196 |
+
@keyframes spin {
|
197 |
+
0% { transform: rotate(0deg); }
|
198 |
+
100% { transform: rotate(360deg); }
|
199 |
+
}
|
models/mammals/static/mammals.js
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
document.addEventListener("DOMContentLoaded", function () {
|
2 |
+
const form = document.getElementById("uploadForm");
|
3 |
+
const fileInput = document.getElementById("fileInput");
|
4 |
+
const predictButton = document.getElementById("predictButton");
|
5 |
+
const loadingIcon = document.getElementById("loadingIcon");
|
6 |
+
|
7 |
+
form.addEventListener("submit", function (event) {
|
8 |
+
event.preventDefault();
|
9 |
+
|
10 |
+
// Show loading icon and change button text
|
11 |
+
loadingIcon.style.display = "inline-block";
|
12 |
+
predictButton.innerHTML = '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Predicting...';
|
13 |
+
|
14 |
+
const formData = new FormData(form);
|
15 |
+
fetch("/predict_mammals", {
|
16 |
+
method: "POST",
|
17 |
+
body: formData,
|
18 |
+
})
|
19 |
+
.then(response => response.json())
|
20 |
+
.then(data => {
|
21 |
+
// Hide loading icon and reset button text
|
22 |
+
loadingIcon.style.display = "none";
|
23 |
+
predictButton.innerHTML = 'Predict';
|
24 |
+
|
25 |
+
displayPredictionResult(data);
|
26 |
+
})
|
27 |
+
.catch(error => {
|
28 |
+
// Hide loading icon in case of error and reset button text
|
29 |
+
loadingIcon.style.display = "none";
|
30 |
+
predictButton.innerHTML = 'Predict';
|
31 |
+
|
32 |
+
console.error("Error:", error);
|
33 |
+
});
|
34 |
+
});
|
35 |
+
|
36 |
+
// Image preview on file input change
|
37 |
+
fileInput.addEventListener("change", function () {
|
38 |
+
const file = fileInput.files[0];
|
39 |
+
if (file) {
|
40 |
+
displayImagePreview(file);
|
41 |
+
}
|
42 |
+
});
|
43 |
+
});
|
44 |
+
|
45 |
+
function displayPredictionResult(data) {
|
46 |
+
const resultDiv = document.getElementById("predictionResult");
|
47 |
+
if (data.confidence < 75) {
|
48 |
+
alert("Please upload a valid or clear image.");
|
49 |
+
} else {
|
50 |
+
resultDiv.innerHTML = `
|
51 |
+
<p>Predicted: ${data.class}</p>
|
52 |
+
<p>Confidence: ${data.confidence}%</p>
|
53 |
+
`;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
function displayImagePreview(file) {
|
58 |
+
const imagePreview = document.getElementById("imagePreview");
|
59 |
+
const imagePreviewContainer = document.getElementById("imagePreviewContainer");
|
60 |
+
|
61 |
+
const reader = new FileReader();
|
62 |
+
reader.onload = function (e) {
|
63 |
+
imagePreview.src = e.target.result;
|
64 |
+
};
|
65 |
+
|
66 |
+
reader.readAsDataURL(file);
|
67 |
+
imagePreviewContainer.style.display = "block";
|
68 |
+
}
|
69 |
+
|
models/sports_ball/Sports_ball_prediction_v2.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6f07ced279cdbd58e8bd936d31e2ed9d1c0a452223f4d6b5f2852e9d8e207ce5
|
3 |
+
size 13239936
|
models/sports_ball/sports_ball.html
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- index.html -->
|
2 |
+
|
3 |
+
<!DOCTYPE html>
|
4 |
+
<html lang="en">
|
5 |
+
<head>
|
6 |
+
<meta charset="UTF-8">
|
7 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
8 |
+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
9 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
10 |
+
<link rel="stylesheet" href="static/sports_ball.css?v=2">
|
11 |
+
<title>Sports Ball Prediction</title>
|
12 |
+
</head>
|
13 |
+
<body>
|
14 |
+
<div class="header-container container">
|
15 |
+
<h1>Sports Ball Prediction</h1>
|
16 |
+
</div>
|
17 |
+
<form id="uploadForm" action="/predict" method="post" enctype="multipart/form-data" class="container">
|
18 |
+
<div id="fileInputContainer">
|
19 |
+
<input type="file" name="file" id="fileInput" accept="image/*">
|
20 |
+
<label for="fileInput" id="fileInputLabel">
|
21 |
+
<i class="fas fa-cloud-upload-alt upload-icon"></i>
|
22 |
+
Drag & Drop or Click to Upload
|
23 |
+
</label>
|
24 |
+
</div>
|
25 |
+
<div id="imageContainer" class="container">
|
26 |
+
<img id="imagePreview">
|
27 |
+
</div>
|
28 |
+
<div id="predictionResult" class="container"></div>
|
29 |
+
<button type="submit" class="predict-btn" id="predictButton">
|
30 |
+
<span class="loading-icon" id="loadingIcon"></span>
|
31 |
+
Predict
|
32 |
+
</button>
|
33 |
+
</form>
|
34 |
+
<script src="static/sports_ball.js"></script>
|
35 |
+
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
36 |
+
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js"></script>
|
37 |
+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
38 |
+
</body>
|
39 |
+
</html>
|
models/sports_ball/static/images/balls.jpg
ADDED
models/sports_ball/static/images/bg10.gif
ADDED
Git LFS Details
|
models/sports_ball/static/images/ronaldo.gif
ADDED
models/sports_ball/static/sports_ball.css
ADDED
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* style.css */
|
2 |
+
|
3 |
+
body, html {
|
4 |
+
margin: 0;
|
5 |
+
padding: 0;
|
6 |
+
height: 100%;
|
7 |
+
}
|
8 |
+
|
9 |
+
body {
|
10 |
+
background-image: url('images/bg10.gif');
|
11 |
+
background-size: cover;
|
12 |
+
background-position: center;
|
13 |
+
background-repeat: no-repeat;
|
14 |
+
font-family: 'Arial', sans-serif;
|
15 |
+
color: #333;
|
16 |
+
overflow-y: scroll;
|
17 |
+
background-attachment: fixed;
|
18 |
+
}
|
19 |
+
|
20 |
+
.container {
|
21 |
+
max-width: 600px; /* Adjust the max-width as needed */
|
22 |
+
margin: 20px auto;
|
23 |
+
padding: 20px;
|
24 |
+
border-radius: 8px;
|
25 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
|
26 |
+
backdrop-filter: blur(0px);
|
27 |
+
}
|
28 |
+
|
29 |
+
.header-container {
|
30 |
+
max-width: 600px;
|
31 |
+
margin: 0 auto;
|
32 |
+
background-color: ##f4d03f;/* Adjust the alpha value for transparency */
|
33 |
+
border-radius: 8px;
|
34 |
+
padding: 20px;
|
35 |
+
border: 1px solid ##3498db;
|
36 |
+
border-radius: 10px;
|
37 |
+
text-align: center;
|
38 |
+
margin-bottom: 20px;
|
39 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
|
40 |
+
backdrop-filter: blur(0px);
|
41 |
+
margin: 20px auto 0;
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
h1 {
|
46 |
+
text-align: center;
|
47 |
+
color: rgb(76, 105, 179);
|
48 |
+
font-weight: bold;
|
49 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
|
50 |
+
margin: 0;
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
+
#fileInputContainer {
|
55 |
+
position: relative;
|
56 |
+
margin-bottom: 20px;
|
57 |
+
border: 1px solid ##3498db;
|
58 |
+
|
59 |
+
}
|
60 |
+
|
61 |
+
#fileInput {
|
62 |
+
position: absolute;
|
63 |
+
top: 0;
|
64 |
+
left: 0;
|
65 |
+
width: 100%;
|
66 |
+
height: 100%;
|
67 |
+
opacity: 0;
|
68 |
+
cursor: pointer;
|
69 |
+
backdrop-filter: blur(0px);
|
70 |
+
border-radius: 8px;
|
71 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
|
72 |
+
}
|
73 |
+
|
74 |
+
#fileInputLabel {
|
75 |
+
display: flex;
|
76 |
+
flex-direction: column;
|
77 |
+
align-items: center;
|
78 |
+
justify-content: center;
|
79 |
+
font-size: 18px;
|
80 |
+
color: #ebe045;
|
81 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
|
82 |
+
font-weight: bold;
|
83 |
+
cursor: pointer;
|
84 |
+
transition: color 0.3s ease;
|
85 |
+
}
|
86 |
+
|
87 |
+
#fileInputLabel:hover {
|
88 |
+
color: #297fb8;
|
89 |
+
}
|
90 |
+
|
91 |
+
#imagePreview {
|
92 |
+
max-width: 100%;
|
93 |
+
height: auto;
|
94 |
+
border: 0px solid #ddd;
|
95 |
+
border-radius: 8px;
|
96 |
+
padding: 10px;
|
97 |
+
backdrop-filter: blur(50px);
|
98 |
+
margin-bottom: 20px;
|
99 |
+
display: block;
|
100 |
+
margin: 0 auto;
|
101 |
+
}
|
102 |
+
#imageContainer {
|
103 |
+
text-align: center;
|
104 |
+
backdrop-filter: blur(10px); /* Adjust the blur value as needed */
|
105 |
+
background-color: rgba(255, 255, 255, 0.5); /* Adjust the alpha value for transparency */
|
106 |
+
border-radius: 8px;
|
107 |
+
padding: 10px;
|
108 |
+
margin-bottom: 20px;
|
109 |
+
display: block;
|
110 |
+
margin: 0 auto;
|
111 |
+
}
|
112 |
+
|
113 |
+
.upload-icon {
|
114 |
+
font-size: 36px;
|
115 |
+
margin-bottom: 10px;
|
116 |
+
}
|
117 |
+
|
118 |
+
.predict-btn {
|
119 |
+
width: 100%;
|
120 |
+
padding: 10px;
|
121 |
+
background-color:rgb(51, 95, 207);
|
122 |
+
color:white;
|
123 |
+
font-weight: bold;
|
124 |
+
border: none;
|
125 |
+
border-radius: 50px;
|
126 |
+
cursor: pointer;
|
127 |
+
transition: background-color 0.3s;
|
128 |
+
}
|
129 |
+
|
130 |
+
.predict-btn:hover {
|
131 |
+
background-color: #33aa3d;
|
132 |
+
letter-spacing: 2px;
|
133 |
+
box-shadow: #297fb8 0px 7px 29px 0px;
|
134 |
+
}
|
135 |
+
|
136 |
+
.predict-btn:active {
|
137 |
+
background-color: #297fb8;
|
138 |
+
letter-spacing: 2px;
|
139 |
+
box-shadow: #297fb8 0px 7px 29px 0px;
|
140 |
+
transform: translateY(10px);
|
141 |
+
}
|
142 |
+
.predict-btn:focus {
|
143 |
+
outline: none;
|
144 |
+
}
|
145 |
+
.predict-btn:after {
|
146 |
+
background-color:rgb(51, 95, 207);
|
147 |
+
}
|
148 |
+
|
149 |
+
#predictionResult {
|
150 |
+
color: black; /* Change the color to white */
|
151 |
+
margin-top: 20px;
|
152 |
+
text-align: center;
|
153 |
+
backdrop-filter: blur(0px);
|
154 |
+
font-weight: bold;
|
155 |
+
border: none;
|
156 |
+
box-shadow: none;
|
157 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9)
|
158 |
+
box-shadow: none;
|
159 |
+
}
|
160 |
+
|
161 |
+
@media only screen and (max-width: 600px) {
|
162 |
+
h1{
|
163 |
+
font-size:25px;
|
164 |
+
font-family: 'Kanit', sans-serif;
|
165 |
+
}
|
166 |
+
#imagePreview {
|
167 |
+
max-width: 70%;
|
168 |
+
height: 60%;
|
169 |
+
border: 0px solid #ddd;
|
170 |
+
border-radius: 8px;
|
171 |
+
padding: 10px;
|
172 |
+
backdrop-filter: blur(50px);
|
173 |
+
margin-bottom: 10px;
|
174 |
+
display: block;
|
175 |
+
margin: 0 auto;
|
176 |
+
}
|
177 |
+
body {
|
178 |
+
background-size: cover; /* or 'contain' based on your preference */
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
.loading-icon {
|
183 |
+
display: none;
|
184 |
+
border: 4px solid #f3f3f3;
|
185 |
+
border-top: 4px solid #3498db;
|
186 |
+
border-radius: 50%;
|
187 |
+
width: 20px;
|
188 |
+
height: 20px;
|
189 |
+
animation: spin 1s linear infinite;
|
190 |
+
}
|
191 |
+
|
192 |
+
@keyframes spin {
|
193 |
+
0% { transform: rotate(0deg); }
|
194 |
+
100% { transform: rotate(360deg); }
|
195 |
+
}
|
models/sports_ball/static/sports_ball.js
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
document.addEventListener("DOMContentLoaded", function () {
|
2 |
+
const form = document.getElementById("uploadForm");
|
3 |
+
const fileInput = document.getElementById("fileInput");
|
4 |
+
const imagePreview = document.getElementById("imagePreview");
|
5 |
+
const predictButton = document.getElementById("predictButton");
|
6 |
+
const loadingIcon = document.getElementById("loadingIcon");
|
7 |
+
|
8 |
+
form.addEventListener("submit", function (event) {
|
9 |
+
event.preventDefault();
|
10 |
+
|
11 |
+
// Show loading icon and change button text
|
12 |
+
loadingIcon.style.display = "inline-block";
|
13 |
+
predictButton.innerHTML = '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Predicting...';
|
14 |
+
|
15 |
+
const formData = new FormData(form);
|
16 |
+
fetch("/predict_sports_ball", {
|
17 |
+
method: "POST",
|
18 |
+
body: formData,
|
19 |
+
})
|
20 |
+
.then(response => response.json())
|
21 |
+
.then(data => {
|
22 |
+
// Hide loading icon and reset button text
|
23 |
+
loadingIcon.style.display = "none";
|
24 |
+
predictButton.innerHTML = 'Predict';
|
25 |
+
|
26 |
+
displayPredictionResult(data);
|
27 |
+
})
|
28 |
+
.catch(error => {
|
29 |
+
// Hide loading icon in case of error and reset button text
|
30 |
+
loadingIcon.style.display = "none";
|
31 |
+
predictButton.innerHTML = 'Predict';
|
32 |
+
|
33 |
+
console.error("Error:", error);
|
34 |
+
});
|
35 |
+
});
|
36 |
+
|
37 |
+
// Image preview on file input change
|
38 |
+
fileInput.addEventListener("change", function () {
|
39 |
+
const file = fileInput.files[0];
|
40 |
+
if (file) {
|
41 |
+
displayImagePreview(file);
|
42 |
+
}
|
43 |
+
});
|
44 |
+
});
|
45 |
+
|
46 |
+
function displayPredictionResult(data) {
|
47 |
+
const resultDiv = document.getElementById("predictionResult");
|
48 |
+
if (data.confidence < 75) {
|
49 |
+
alert("Please upload a valid or clear image.");
|
50 |
+
} else {
|
51 |
+
resultDiv.innerHTML = `
|
52 |
+
<p>Predicted: ${data.class}</p>
|
53 |
+
<p>Confidence: ${data.confidence}%</p>
|
54 |
+
`;
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
function displayImagePreview(file) {
|
59 |
+
const imagePreview = document.getElementById("imagePreview");
|
60 |
+
const imagePreviewContainer = document.getElementById("imageContainer");
|
61 |
+
|
62 |
+
const reader = new FileReader();
|
63 |
+
reader.onload = function (e) {
|
64 |
+
imagePreview.src = e.target.result;
|
65 |
+
};
|
66 |
+
|
67 |
+
reader.readAsDataURL(file);
|
68 |
+
imagePreviewContainer.style.display = "block";
|
69 |
+
}
|
models/weather/static/images/bg.jpg
ADDED
Git LFS Details
|