Maaz Uddin
allfilesupload
e0a433a
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>House Price Predictor</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
padding: 20px;
background-color: #f8f9fa;
}
.container {
max-width: 800px;
background-color: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
margin-top: 50px;
}
.prediction-result {
margin-top: 20px;
padding: 20px;
border-radius: 5px;
background-color: #e9ecef;
}
.property-details {
margin-top: 20px;
padding: 15px;
border: 1px solid #dee2e6;
border-radius: 5px;
}
</style>
</head>
<body>
<div class="container">
<h2 class="text-center mb-4">Bangalore House Price Predictor</h2>
{% if error %}
<div class="alert alert-danger" role="alert">
{{ error }}
</div>
{% endif %}
<form method="POST" class="needs-validation" novalidate>
<div class="mb-3">
<label for="location" class="form-label">Location:</label>
<select class="form-select" id="location" name="location" required>
<option value="">Select a location</option>
{% for location in locations %}
<option value="{{ location }}">{{ location }}</option>
{% endfor %}
</select>
</div>
<div class="mb-3">
<label for="sqft" class="form-label">Total Square Feet:</label>
<input type="number" class="form-control" id="sqft" name="sqft" min="100" required>
</div>
<div class="mb-3">
<label for="bath" class="form-label">Number of Bathrooms:</label>
<input type="number" class="form-control" id="bath" name="bath" min="1" max="10" required>
</div>
<div class="mb-3">
<label for="bhk" class="form-label">BHK (Bedrooms):</label>
<input type="number" class="form-control" id="bhk" name="bhk" min="1" max="10" required>
</div>
<div class="text-center">
<button type="submit" class="btn btn-primary">Predict Price</button>
</div>
</form>
{% if prediction is not none %}
<div class="prediction-result text-center">
<h4>Predicted Price:</h4>
<p class="h3">₹ {{ prediction }} Lakhs</p>
{% if property_details %}
<div class="property-details">
<h5>Property Details:</h5>
<ul class="list-unstyled">
<li><strong>Location:</strong> {{ property_details.location }}</li>
<li><strong>Area:</strong> {{ property_details.sqft }} sq.ft</li>
<li><strong>Bathrooms:</strong> {{ property_details.bath }}</li>
<li><strong>BHK:</strong> {{ property_details.bhk }}</li>
</ul>
</div>
{% endif %}
</div>
{% endif %}
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script>
// Form validation
(function () {
'use strict'
var forms = document.querySelectorAll('.needs-validation')
Array.prototype.slice.call(forms).forEach(function (form) {
form.addEventListener('submit', function (event) {
if (!form.checkValidity()) {
event.preventDefault()
event.stopPropagation()
}
form.classList.add('was-validated')
}, false)
})
})()
</script>
</body>
</html>