Spaces:
Running
Running
File size: 6,313 Bytes
7154df8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
<!-- templates/index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Plant Disease Detector</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
background-color: #f8f9fa;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.hero-section {
background-color: #28a745;
color: white;
padding: 3rem 0;
margin-bottom: 2rem;
}
.upload-container {
background-color: white;
border-radius: 10px;
padding: 2rem;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.instructions {
background-color: #e9f7ef;
border-left: 4px solid #28a745;
padding: 1rem;
margin-bottom: 1.5rem;
}
.preview-container {
max-width: 300px;
max-height: 300px;
overflow: hidden;
margin: 0 auto;
border: 2px dashed #dee2e6;
border-radius: 5px;
display: flex;
align-items: center;
justify-content: center;
}
#imagePreview {
max-width: 100%;
max-height: 100%;
display: none;
}
</style>
</head>
<body>
<div class="hero-section">
<div class="container text-center">
<h1 class="display-4">Plant Disease & Pest Detector</h1>
<p class="lead">Upload an image of your plant to detect diseases and pests</p>
</div>
</div>
<div class="container mb-5">
{% with messages = get_flashed_messages() %}
{% if messages %}
{% for message in messages %}
<div class="alert alert-warning alert-dismissible fade show" role="alert">
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
{% endfor %}
{% endif %}
{% endwith %}
<div class="row justify-content-center">
<div class="col-md-8">
<div class="upload-container">
<div class="instructions">
<h5>How to use:</h5>
<ol>
<li>Select an image of your plant (preferably showing affected areas)</li>
<li>Enter the name of the plant (e.g., Tomato, Rice, Potato)</li>
<li>Click "Analyze Plant" to detect diseases or pests</li>
</ol>
</div>
<form action="/analyze" method="post" enctype="multipart/form-data">
<div class="mb-4">
<div class="preview-container mb-3">
<img id="imagePreview" src="#" alt="Image Preview">
<span id="previewPlaceholder">Image preview will appear here</span>
</div>
<label for="plant_image" class="form-label">Upload Plant Image</label>
<input class="form-control" type="file" id="plant_image" name="plant_image" accept="image/*" required onchange="previewImage(event)">
</div>
<div class="mb-4">
<label for="plant_name" class="form-label">Plant Name</label>
<input type="text" class="form-control" id="plant_name" name="plant_name" placeholder="e.g., Tomato, Rice, Potato" required>
</div>
<div class="mb-4">
<label for="language" class="form-label">Response Language</label>
<select class="form-control" id="language" name="language" required>
<option value="English">English</option>
<option value="Hindi">Hindi</option>
<option value="Bengali">Bengali</option>
<option value="Telugu">Telugu</option>
<option value="Marathi">Marathi</option>
<option value="Tamil">Tamil</option>
<option value="Gujarati">Gujarati</option>
<option value="Urdu">Urdu</option>
<option value="Kannada">Kannada</option>
<option value="Odia">Odia</option>
<option value="Malayalam">Malayalam</option>
</select>
</div>
<div class="d-grid">
<button type="submit" class="btn btn-success btn-lg">Analyze Plant</button>
</div>
</form>
</div>
</div>
</div>
</div>
<footer class="bg-dark text-white text-center py-3">
<div class="container">
<p class="mb-0">Plant Disease Detector © 2025 | Powered by Gemini AI</p>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script>
function previewImage(event) {
var reader = new FileReader();
reader.onload = function() {
var output = document.getElementById('imagePreview');
output.src = reader.result;
output.style.display = 'block';
document.getElementById('previewPlaceholder').style.display = 'none';
};
reader.readAsDataURL(event.target.files[0]);
}
</script>
</body>
</html> |