crop / index.html
omgy's picture
Update index.html
d5d2cd3 verified
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Crop Disease Detector</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: #f0f4f8;
display: flex;
flex-direction: column;
align-items: center;
padding: 40px 20px;
color: #333;
}
h1 {
background: linear-gradient(90deg, #4caf50, #81c784);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-size: 2.5rem;
margin-bottom: 30px;
text-align: center;
}
.card {
background: #fff;
padding: 30px;
border-radius: 15px;
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 500px;
text-align: center;
transition: transform 0.2s ease;
}
.card:hover {
transform: translateY(-5px);
}
input[type="file"] {
display: block;
margin: 20px auto;
font-size: 1rem;
}
button {
background: linear-gradient(90deg, #4caf50, #81c784);
border: none;
color: #fff;
padding: 12px 25px;
font-size: 1rem;
border-radius: 8px;
cursor: pointer;
transition: background 0.3s ease, transform 0.2s ease;
margin-bottom: 20px;
}
button:hover {
background: linear-gradient(90deg, #388e3c, #66bb6a);
transform: translateY(-2px);
}
pre {
background: #f4f4f4;
padding: 15px;
border-radius: 8px;
font-size: 1.1rem;
color: #222;
min-height: 50px;
overflow-x: auto;
text-align: left;
white-space: pre-wrap;
word-wrap: break-word;
}
footer {
margin-top: 40px;
font-size: 0.9rem;
color: #666;
}
</style>
</head>
<body>
<h1>Crop Disease Detector</h1>
<div class="card">
<input type="file" id="fileInput" accept="image/*">
<button onclick="upload()">Analyze</button>
<pre id="output">Your result will appear here...</pre>
</div>
<script>
async function upload() {
const file = document.getElementById('fileInput').files[0];
if (!file) { alert('Choose an image first'); return; }
const form = new FormData();
form.append("file", file);
const output = document.getElementById("output");
output.textContent = "Analyzing image...";
try {
const res = await fetch("/analyze", { method: "POST", body: form });
const data = await res.json();
output.textContent = data.result;
} catch (err) {
output.textContent = "Error: " + err.message;
}
}
</script>
</body>
</html>