Lucky Sharma
commited on
Upload 8 files
Browse files- app.py +70 -0
- iris_flower_Detection_ML-1.ipynb +0 -0
- iris_model.pkl +3 -0
- new_iris_model.pkl +3 -0
- requirements.txt +3 -0
- static/flower-animation.css +79 -0
- templates/form.html +174 -0
- templates/result.html +188 -0
app.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from flask import Flask, render_template, request
|
| 2 |
+
import joblib
|
| 3 |
+
import numpy as np
|
| 4 |
+
from sklearn import datasets
|
| 5 |
+
import os
|
| 6 |
+
|
| 7 |
+
app = Flask(__name__)
|
| 8 |
+
|
| 9 |
+
# Load the model and iris dataset for target names
|
| 10 |
+
print("Starting Iris Flower Classification Application...")
|
| 11 |
+
try:
|
| 12 |
+
# Try loading the new model first, then fall back to the original model
|
| 13 |
+
if os.path.exists('new_iris_model.pkl'):
|
| 14 |
+
model = joblib.load('new_iris_model.pkl')
|
| 15 |
+
print("Successfully loaded new_iris_model.pkl")
|
| 16 |
+
else:
|
| 17 |
+
model = joblib.load('iris_model.pkl')
|
| 18 |
+
print("Successfully loaded iris_model.pkl")
|
| 19 |
+
|
| 20 |
+
# Load iris dataset to get target names
|
| 21 |
+
iris = datasets.load_iris()
|
| 22 |
+
class_names = iris.target_names
|
| 23 |
+
print(f"Class names: {class_names}")
|
| 24 |
+
|
| 25 |
+
except Exception as e:
|
| 26 |
+
print(f"Error loading model or dataset: {e}")
|
| 27 |
+
# Fallback to class names if model fails to load
|
| 28 |
+
class_names = ['setosa', 'versicolor', 'virginica']
|
| 29 |
+
model = None
|
| 30 |
+
|
| 31 |
+
@app.route('/')
|
| 32 |
+
def form():
|
| 33 |
+
return render_template('form.html')
|
| 34 |
+
|
| 35 |
+
@app.route('/predict', methods=['POST'])
|
| 36 |
+
def predict():
|
| 37 |
+
try:
|
| 38 |
+
if model is None:
|
| 39 |
+
raise Exception("Model failed to load")
|
| 40 |
+
|
| 41 |
+
# Get form values as float
|
| 42 |
+
features = [
|
| 43 |
+
float(request.form['sepal_length']),
|
| 44 |
+
float(request.form['sepal_width']),
|
| 45 |
+
float(request.form['petal_length']),
|
| 46 |
+
float(request.form['petal_width'])
|
| 47 |
+
]
|
| 48 |
+
|
| 49 |
+
# Make prediction
|
| 50 |
+
prediction = model.predict([features])[0]
|
| 51 |
+
|
| 52 |
+
# Get the class name (flower species)
|
| 53 |
+
species = class_names[prediction]
|
| 54 |
+
|
| 55 |
+
# Capitalize the species name for display
|
| 56 |
+
species_display = f"Iris {species}"
|
| 57 |
+
|
| 58 |
+
# Print debug info
|
| 59 |
+
print(f"Input features: {features}")
|
| 60 |
+
print(f"Prediction: {prediction}, Species: {species_display}")
|
| 61 |
+
|
| 62 |
+
return render_template('result.html', prediction=species_display)
|
| 63 |
+
|
| 64 |
+
except Exception as e:
|
| 65 |
+
error_message = f"Error making prediction: {str(e)}"
|
| 66 |
+
print(error_message)
|
| 67 |
+
return render_template('result.html', prediction="Error: Could not make prediction", error=error_message)
|
| 68 |
+
|
| 69 |
+
if __name__ == '__main__':
|
| 70 |
+
app.run(host="0.0.0.0", port=5000, debug=True)
|
iris_flower_Detection_ML-1.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
iris_model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7dd519a1e3a5fd47332542e4fcc216ab647fe7d206753ba8be0d2a092710c3d0
|
| 3 |
+
size 190065
|
new_iris_model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:74dc662abd574fa2789ab1fc43ba21d92cd3c90d63323ff54335f8b55ddd0448
|
| 3 |
+
size 186721
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
flask
|
| 2 |
+
numpy
|
| 3 |
+
scikit-learn
|
static/flower-animation.css
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* CSS for flower background animations */
|
| 2 |
+
.flower-background {
|
| 3 |
+
position: fixed;
|
| 4 |
+
top: 0;
|
| 5 |
+
left: 0;
|
| 6 |
+
width: 100%;
|
| 7 |
+
height: 100%;
|
| 8 |
+
z-index: -2;
|
| 9 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 10 |
+
opacity: 0.1;
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
.flower-particles {
|
| 14 |
+
position: fixed;
|
| 15 |
+
top: 0;
|
| 16 |
+
left: 0;
|
| 17 |
+
width: 100%;
|
| 18 |
+
height: 100%;
|
| 19 |
+
z-index: -1;
|
| 20 |
+
pointer-events: none;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
.flower-particles::before {
|
| 24 |
+
content: '🌸';
|
| 25 |
+
position: absolute;
|
| 26 |
+
top: 10%;
|
| 27 |
+
left: 5%;
|
| 28 |
+
font-size: 1.5em;
|
| 29 |
+
animation: float 8s ease-in-out infinite;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
.flower-particles::after {
|
| 33 |
+
content: '🌺';
|
| 34 |
+
position: absolute;
|
| 35 |
+
top: 70%;
|
| 36 |
+
right: 10%;
|
| 37 |
+
font-size: 1.2em;
|
| 38 |
+
animation: float 6s ease-in-out infinite reverse;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/* Additional floating flowers */
|
| 42 |
+
.flower-extra {
|
| 43 |
+
position: fixed;
|
| 44 |
+
top: 40%;
|
| 45 |
+
left: 80%;
|
| 46 |
+
font-size: 1.8em;
|
| 47 |
+
animation: float 7s ease-in-out infinite;
|
| 48 |
+
z-index: -1;
|
| 49 |
+
pointer-events: none;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
.flower-extra::before {
|
| 53 |
+
content: '🌷';
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
.flower-extra2 {
|
| 57 |
+
position: fixed;
|
| 58 |
+
top: 80%;
|
| 59 |
+
left: 20%;
|
| 60 |
+
font-size: 1.3em;
|
| 61 |
+
animation: float 5s ease-in-out infinite reverse;
|
| 62 |
+
z-index: -1;
|
| 63 |
+
pointer-events: none;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
.flower-extra2::before {
|
| 67 |
+
content: '🌻';
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
@keyframes float {
|
| 71 |
+
0%, 100% {
|
| 72 |
+
transform: translateY(0px) rotate(0deg);
|
| 73 |
+
opacity: 0.7;
|
| 74 |
+
}
|
| 75 |
+
50% {
|
| 76 |
+
transform: translateY(-20px) rotate(180deg);
|
| 77 |
+
opacity: 1;
|
| 78 |
+
}
|
| 79 |
+
}
|
templates/form.html
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<title>Iris Predictor</title>
|
| 5 |
+
<link rel="stylesheet" href="{{ url_for('static', filename='flower-animation.css') }}">
|
| 6 |
+
<style>
|
| 7 |
+
body {
|
| 8 |
+
font-family: Arial, sans-serif;
|
| 9 |
+
max-width: 600px;
|
| 10 |
+
margin: 0 auto;
|
| 11 |
+
padding: 20px;
|
| 12 |
+
background-color: #f5f5f5;
|
| 13 |
+
position: relative;
|
| 14 |
+
min-height: 100vh;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
.video-background {
|
| 18 |
+
position: fixed;
|
| 19 |
+
top: 0;
|
| 20 |
+
left: 0;
|
| 21 |
+
width: 100%;
|
| 22 |
+
height: 100%;
|
| 23 |
+
z-index: -1;
|
| 24 |
+
overflow: hidden;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
.video-background video {
|
| 28 |
+
width: 100%;
|
| 29 |
+
height: 100%;
|
| 30 |
+
object-fit: cover;
|
| 31 |
+
opacity: 0.3;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
.video-background::after {
|
| 35 |
+
content: '';
|
| 36 |
+
position: absolute;
|
| 37 |
+
top: 0;
|
| 38 |
+
left: 0;
|
| 39 |
+
width: 100%;
|
| 40 |
+
height: 100%;
|
| 41 |
+
background: rgba(255, 255, 255, 0.7);
|
| 42 |
+
}
|
| 43 |
+
h2 {
|
| 44 |
+
color: #4CAF50;
|
| 45 |
+
text-align: center;
|
| 46 |
+
}
|
| 47 |
+
form {
|
| 48 |
+
background-color: rgba(255, 255, 255, 0.95);
|
| 49 |
+
padding: 20px;
|
| 50 |
+
border-radius: 10px;
|
| 51 |
+
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
|
| 52 |
+
backdrop-filter: blur(10px);
|
| 53 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 54 |
+
}
|
| 55 |
+
input[type="text"] {
|
| 56 |
+
width: 100%;
|
| 57 |
+
padding: 10px;
|
| 58 |
+
margin: 8px 0;
|
| 59 |
+
display: inline-block;
|
| 60 |
+
border: 1px solid #ccc;
|
| 61 |
+
border-radius: 4px;
|
| 62 |
+
box-sizing: border-box;
|
| 63 |
+
}
|
| 64 |
+
input[type="submit"] {
|
| 65 |
+
width: 100%;
|
| 66 |
+
background-color: #4CAF50;
|
| 67 |
+
color: white;
|
| 68 |
+
padding: 14px 20px;
|
| 69 |
+
margin: 8px 0;
|
| 70 |
+
border: none;
|
| 71 |
+
border-radius: 4px;
|
| 72 |
+
cursor: pointer;
|
| 73 |
+
}
|
| 74 |
+
input[type="submit"]:hover {
|
| 75 |
+
background-color: #45a049;
|
| 76 |
+
}
|
| 77 |
+
.note {
|
| 78 |
+
margin-top: 20px;
|
| 79 |
+
font-size: 0.9em;
|
| 80 |
+
color: #666;
|
| 81 |
+
background-color: rgba(255, 255, 255, 0.9);
|
| 82 |
+
padding: 15px;
|
| 83 |
+
border-radius: 8px;
|
| 84 |
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
.flower-animation {
|
| 88 |
+
position: absolute;
|
| 89 |
+
top: 20px;
|
| 90 |
+
right: 20px;
|
| 91 |
+
width: 60px;
|
| 92 |
+
height: 60px;
|
| 93 |
+
background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMzAiIGN5PSIzMCIgcj0iOCIgZmlsbD0iI0ZGRjIwMCIvPgo8cGF0aCBkPSJNMjIgMzBDMjIgMzQuNDE4IDI1LjU4MiAzOCAzMCAzOEMzNC40MTggMzggMzggMzQuNDE4IDM4IDMwIiBzdHJva2U9IiNGRjY5QjQiIHN0cm9rZS13aWR0aD0iNCIvPgo8cGF0aCBkPSJNMzAgMjJDMjUuNTgyIDIyIDIyIDI1LjU4MiAyMiAzMCIgc3Ryb2tlPSIjRkY2OUI0IiBzdHJva2Utd2lkdGg9IjQiLz4KPHBhdGggZD0iTTM4IDMwQzM4IDI1LjU4MiAzNC40MTggMjIgMzAgMjIiIHN0cm9rZT0iI0ZGNjlCNCIgc3Ryb2tlLXdpZHRoPSI0Ii8+CjxwYXRoIGQ9Ik0zMCAzOEMzNCA0MiAzNyA0MiAzOSA0MiIgc3Ryb2tlPSIjNENBRjUwIiBzdHJva2Utd2lkdGg9IjMiLz4KPC9zdmc+') no-repeat center center;
|
| 94 |
+
background-size: contain;
|
| 95 |
+
animation: rotate 3s linear infinite;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
@keyframes rotate {
|
| 99 |
+
0% { transform: rotate(0deg); }
|
| 100 |
+
100% { transform: rotate(360deg); }
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
.floating-flowers {
|
| 104 |
+
position: fixed;
|
| 105 |
+
top: 0;
|
| 106 |
+
left: 0;
|
| 107 |
+
width: 100%;
|
| 108 |
+
height: 100%;
|
| 109 |
+
pointer-events: none;
|
| 110 |
+
z-index: -1;
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
.floating-flowers::before {
|
| 114 |
+
content: '🌸';
|
| 115 |
+
position: absolute;
|
| 116 |
+
top: 20%;
|
| 117 |
+
left: 10%;
|
| 118 |
+
font-size: 2em;
|
| 119 |
+
animation: float 6s ease-in-out infinite;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
.floating-flowers::after {
|
| 123 |
+
content: '🌺';
|
| 124 |
+
position: absolute;
|
| 125 |
+
top: 60%;
|
| 126 |
+
right: 15%;
|
| 127 |
+
font-size: 1.5em;
|
| 128 |
+
animation: float 4s ease-in-out infinite reverse;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
@keyframes float {
|
| 132 |
+
0%, 100% { transform: translateY(0px); }
|
| 133 |
+
50% { transform: translateY(-20px); }
|
| 134 |
+
}
|
| 135 |
+
</style>
|
| 136 |
+
</head>
|
| 137 |
+
<body>
|
| 138 |
+
<!-- Background video -->
|
| 139 |
+
<div class="video-background">
|
| 140 |
+
<video autoplay muted loop>
|
| 141 |
+
<source src="{{ url_for('static', filename='videos/flowers.mp4') }}" type="video/mp4">
|
| 142 |
+
<source src="https://cdn.pixabay.com/video/2019/06/10/24170-342584456_large.mp4" type="video/mp4">
|
| 143 |
+
<!-- Fallback for browsers that don't support video -->
|
| 144 |
+
<source src="https://media.giphy.com/media/3o7TKQkJJj8PJMJJhK/giphy.gif" type="video/gif">
|
| 145 |
+
</video>
|
| 146 |
+
</div>
|
| 147 |
+
|
| 148 |
+
<!-- Flower background -->
|
| 149 |
+
<div class="flower-background"></div>
|
| 150 |
+
|
| 151 |
+
<!-- Floating flowers animation -->
|
| 152 |
+
<div class="floating-flowers"></div>
|
| 153 |
+
<div class="flower-extra"></div>
|
| 154 |
+
<div class="flower-extra2"></div>
|
| 155 |
+
|
| 156 |
+
<!-- Animated flower icon -->
|
| 157 |
+
<div class="flower-animation"></div>
|
| 158 |
+
|
| 159 |
+
<h2>🌸 Iris Flower Prediction 🌸</h2>
|
| 160 |
+
<form action="/predict" method="POST">
|
| 161 |
+
<input type="text" name="sepal_length" placeholder="Sepal Length (cm)" required><br>
|
| 162 |
+
<input type="text" name="sepal_width" placeholder="Sepal Width (cm)" required><br>
|
| 163 |
+
<input type="text" name="petal_length" placeholder="Petal Length (cm)" required><br>
|
| 164 |
+
<input type="text" name="petal_width" placeholder="Petal Width (cm)" required><br>
|
| 165 |
+
<input type="submit" value="Predict Flower Species">
|
| 166 |
+
</form>
|
| 167 |
+
<div class="note">
|
| 168 |
+
<p><strong>Example values:</strong></p>
|
| 169 |
+
<p>Setosa: Sepal Length=5.1, Sepal Width=3.5, Petal Length=1.4, Petal Width=0.2</p>
|
| 170 |
+
<p>Versicolor: Sepal Length=6.0, Sepal Width=2.7, Petal Length=4.2, Petal Width=1.3</p>
|
| 171 |
+
<p>Virginica: Sepal Length=6.8, Sepal Width=3.0, Petal Length=5.5, Petal Width=2.1</p>
|
| 172 |
+
</div>
|
| 173 |
+
</body>
|
| 174 |
+
</html>
|
templates/result.html
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<title>Prediction Result</title>
|
| 5 |
+
<link rel="stylesheet" href="{{ url_for('static', filename='flower-animation.css') }}">
|
| 6 |
+
<style>
|
| 7 |
+
body {
|
| 8 |
+
font-family: Arial, sans-serif;
|
| 9 |
+
max-width: 600px;
|
| 10 |
+
margin: 0 auto;
|
| 11 |
+
padding: 20px;
|
| 12 |
+
background-color: #f5f5f5;
|
| 13 |
+
position: relative;
|
| 14 |
+
min-height: 100vh;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
.video-background {
|
| 18 |
+
position: fixed;
|
| 19 |
+
top: 0;
|
| 20 |
+
left: 0;
|
| 21 |
+
width: 100%;
|
| 22 |
+
height: 100%;
|
| 23 |
+
z-index: -1;
|
| 24 |
+
overflow: hidden;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
.video-background video {
|
| 28 |
+
width: 100%;
|
| 29 |
+
height: 100%;
|
| 30 |
+
object-fit: cover;
|
| 31 |
+
opacity: 0.3;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
.video-background::after {
|
| 35 |
+
content: '';
|
| 36 |
+
position: absolute;
|
| 37 |
+
top: 0;
|
| 38 |
+
left: 0;
|
| 39 |
+
width: 100%;
|
| 40 |
+
height: 100%;
|
| 41 |
+
background: rgba(255, 255, 255, 0.7);
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
.result-container {
|
| 45 |
+
background-color: rgba(255, 255, 255, 0.95);
|
| 46 |
+
padding: 20px;
|
| 47 |
+
border-radius: 10px;
|
| 48 |
+
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
|
| 49 |
+
text-align: center;
|
| 50 |
+
backdrop-filter: blur(10px);
|
| 51 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 52 |
+
}
|
| 53 |
+
h2 {
|
| 54 |
+
color: #4CAF50;
|
| 55 |
+
}
|
| 56 |
+
.prediction {
|
| 57 |
+
font-size: 24px;
|
| 58 |
+
color: #333;
|
| 59 |
+
margin: 20px 0;
|
| 60 |
+
}
|
| 61 |
+
.back-btn {
|
| 62 |
+
display: inline-block;
|
| 63 |
+
background-color: #4CAF50;
|
| 64 |
+
color: white;
|
| 65 |
+
padding: 10px 20px;
|
| 66 |
+
text-decoration: none;
|
| 67 |
+
border-radius: 4px;
|
| 68 |
+
margin-top: 20px;
|
| 69 |
+
}
|
| 70 |
+
.back-btn:hover {
|
| 71 |
+
background-color: #45a049;
|
| 72 |
+
}
|
| 73 |
+
.flower-info {
|
| 74 |
+
margin-top: 20px;
|
| 75 |
+
text-align: left;
|
| 76 |
+
padding: 15px;
|
| 77 |
+
background-color: rgba(249, 249, 249, 0.9);
|
| 78 |
+
border-radius: 8px;
|
| 79 |
+
}
|
| 80 |
+
.error {
|
| 81 |
+
color: #D8000C;
|
| 82 |
+
background-color: rgba(255, 210, 210, 0.9);
|
| 83 |
+
padding: 10px;
|
| 84 |
+
border-radius: 5px;
|
| 85 |
+
margin: 10px 0;
|
| 86 |
+
text-align: left;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
.floating-flowers {
|
| 90 |
+
position: fixed;
|
| 91 |
+
top: 0;
|
| 92 |
+
left: 0;
|
| 93 |
+
width: 100%;
|
| 94 |
+
height: 100%;
|
| 95 |
+
pointer-events: none;
|
| 96 |
+
z-index: -1;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
.floating-flowers::before {
|
| 100 |
+
content: '🌸';
|
| 101 |
+
position: absolute;
|
| 102 |
+
top: 20%;
|
| 103 |
+
left: 10%;
|
| 104 |
+
font-size: 2em;
|
| 105 |
+
animation: float 6s ease-in-out infinite;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
.floating-flowers::after {
|
| 109 |
+
content: '🌺';
|
| 110 |
+
position: absolute;
|
| 111 |
+
top: 60%;
|
| 112 |
+
right: 15%;
|
| 113 |
+
font-size: 1.5em;
|
| 114 |
+
animation: float 4s ease-in-out infinite reverse;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
@keyframes float {
|
| 118 |
+
0%, 100% { transform: translateY(0px); }
|
| 119 |
+
50% { transform: translateY(-20px); }
|
| 120 |
+
}
|
| 121 |
+
</style>
|
| 122 |
+
</head>
|
| 123 |
+
<body>
|
| 124 |
+
<!-- Background video -->
|
| 125 |
+
<div class="video-background">
|
| 126 |
+
<video autoplay muted loop>
|
| 127 |
+
<source src="{{ url_for('static', filename='videos/flowers.mp4') }}" type="video/mp4">
|
| 128 |
+
<source src="https://cdn.pixabay.com/video/2019/06/10/24170-342584456_large.mp4" type="video/mp4">
|
| 129 |
+
<!-- Fallback for browsers that don't support video -->
|
| 130 |
+
<source src="https://media.giphy.com/media/3o7TKQkJJj8PJMJJhK/giphy.gif" type="video/gif">
|
| 131 |
+
</video>
|
| 132 |
+
</div>
|
| 133 |
+
|
| 134 |
+
<!-- Flower background -->
|
| 135 |
+
<div class="flower-background"></div>
|
| 136 |
+
|
| 137 |
+
<!-- Floating flowers animation -->
|
| 138 |
+
<div class="floating-flowers"></div>
|
| 139 |
+
<div class="flower-extra"></div>
|
| 140 |
+
<div class="flower-extra2"></div>
|
| 141 |
+
|
| 142 |
+
<div class="result-container">
|
| 143 |
+
<h2>🌸 Prediction Result 🌸</h2>
|
| 144 |
+
|
| 145 |
+
{% if error %}
|
| 146 |
+
<div class="error">
|
| 147 |
+
<p>{{ error }}</p>
|
| 148 |
+
<p>Please try again with different values or contact support.</p>
|
| 149 |
+
</div>
|
| 150 |
+
{% else %}
|
| 151 |
+
<div class="prediction">
|
| 152 |
+
The predicted flower is: <strong>{{ prediction }}</strong>
|
| 153 |
+
</div>
|
| 154 |
+
|
| 155 |
+
{% if 'setosa' in prediction.lower() %}
|
| 156 |
+
<div class="flower-info">
|
| 157 |
+
<p><strong>Iris setosa</strong> is known for its:</p>
|
| 158 |
+
<ul>
|
| 159 |
+
<li>Small petal size</li>
|
| 160 |
+
<li>Distinctive blue-green foliage</li>
|
| 161 |
+
<li>Native to North America and eastern Asia</li>
|
| 162 |
+
</ul>
|
| 163 |
+
</div>
|
| 164 |
+
{% elif 'versicolor' in prediction.lower() %}
|
| 165 |
+
<div class="flower-info">
|
| 166 |
+
<p><strong>Iris versicolor</strong> is known for its:</p>
|
| 167 |
+
<ul>
|
| 168 |
+
<li>Medium-sized flowers</li>
|
| 169 |
+
<li>Blue to purple coloration</li>
|
| 170 |
+
<li>Native to eastern North America</li>
|
| 171 |
+
</ul>
|
| 172 |
+
</div>
|
| 173 |
+
{% elif 'virginica' in prediction.lower() %}
|
| 174 |
+
<div class="flower-info">
|
| 175 |
+
<p><strong>Iris virginica</strong> is known for its:</p>
|
| 176 |
+
<ul>
|
| 177 |
+
<li>Large petal size</li>
|
| 178 |
+
<li>Violet blue to purple coloration</li>
|
| 179 |
+
<li>Native to eastern North America</li>
|
| 180 |
+
</ul>
|
| 181 |
+
</div>
|
| 182 |
+
{% endif %}
|
| 183 |
+
{% endif %}
|
| 184 |
+
|
| 185 |
+
<a href="/" class="back-btn">Make Another Prediction</a>
|
| 186 |
+
</div>
|
| 187 |
+
</body>
|
| 188 |
+
</html>
|