| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>HeartGuardian - Heart Disease Prediction</title> |
| <link rel="icon" type="image/x-icon" href="/static/favicon.ico"> |
| <script src="https://cdn.tailwindcss.com"></script> |
| <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> |
| <script src="https://unpkg.com/feather-icons"></script> |
| <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.net.min.js"></script> |
| <style> |
| .gradient-bg { |
| background: linear-gradient(135deg, #f43f5e 0%, #8b5cf6 100%); |
| } |
| .input-field { |
| transition: all 0.3s ease; |
| } |
| .input-field:focus { |
| box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.3); |
| border-color: #f43f5e; |
| } |
| .pulse-animation { |
| animation: pulse 2s infinite; |
| } |
| @keyframes pulse { |
| 0% { transform: scale(1); } |
| 50% { transform: scale(1.05); } |
| 100% { transform: scale(1); } |
| } |
| </style> |
| </head> |
| <body class="min-h-screen bg-gray-50"> |
| <div id="vanta-bg" class="fixed inset-0 z-0"></div> |
| <div class="relative z-10 min-h-screen flex flex-col"> |
| <header class="gradient-bg text-white shadow-lg"> |
| <div class="container mx-auto px-4 py-6 flex justify-between items-center"> |
| <div class="flex items-center space-x-2"> |
| <i data-feather="heart" class="w-8 h-8 text-white"></i> |
| <h1 class="text-2xl font-bold">HeartGuardian</h1> |
| </div> |
| <nav> |
| <ul class="flex space-x-6"> |
| <li><a href="#" class="hover:underline">Home</a></li> |
| <li><a href="#" class="hover:underline">About</a></li> |
| <li><a href="#" class="hover:underline">Contact</a></li> |
| </ul> |
| </nav> |
| </div> |
| </header> |
|
|
| <main class="flex-grow container mx-auto px-4 py-12"> |
| <div class="max-w-4xl mx-auto bg-white rounded-xl shadow-2xl overflow-hidden"> |
| <div class="gradient-bg px-6 py-4"> |
| <h2 class="text-2xl font-bold text-white">Heart Disease Prediction</h2> |
| <p class="text-white opacity-90">Enter patient details to assess heart disease risk</p> |
| </div> |
|
|
| <form method="post" class="p-6 grid grid-cols-1 md:grid-cols-2 gap-6"> |
| <div class="space-y-4"> |
| <div> |
| <label class="block text-gray-700 font-medium mb-2">Age</label> |
| <input type="number" step="1" name="age" required |
| class="w-full px-4 py-2 rounded-lg border border-gray-300 input-field focus:outline-none"> |
| </div> |
| <div> |
| <label class="block text-gray-700 font-medium mb-2">Sex</label> |
| <div class="flex space-x-4"> |
| <label class="inline-flex items-center"> |
| <input type="radio" name="sex" value="0" class="form-radio text-rose-500" required> |
| <span class="ml-2">Female</span> |
| </label> |
| <label class="inline-flex items-center"> |
| <input type="radio" name="sex" value="1" class="form-radio text-rose-500"> |
| <span class="ml-2">Male</span> |
| </label> |
| </div> |
| </div> |
| <div> |
| <label class="block text-gray-700 font-medium mb-2">Chest Pain Type</label> |
| <select name="cp" required class="w-full px-4 py-2 rounded-lg border border-gray-300 input-field focus:outline-none"> |
| <option value="">Select type</option> |
| <option value="0">0 - Typical angina</option> |
| <option value="1">1 - Atypical angina</option> |
| <option value="2">2 - Non-anginal pain</option> |
| <option value="3">3 - Asymptomatic</option> |
| </select> |
| </div> |
| <div> |
| <label class="block text-gray-700 font-medium mb-2">Resting Blood Pressure</label> |
| <input type="number" step="0.1" name="trestbps" required |
| class="w-full px-4 py-2 rounded-lg border border-gray-300 input-field focus:outline-none"> |
| </div> |
| <div> |
| <label class="block text-gray-700 font-medium mb-2">Cholesterol</label> |
| <input type="number" step="0.1" name="chol" required |
| class="w-full px-4 py-2 rounded-lg border border-gray-300 input-field focus:outline-none"> |
| </div> |
| <div> |
| <label class="block text-gray-700 font-medium mb-2">Fasting Blood Sugar > 120 mg/dl</label> |
| <div class="flex space-x-4"> |
| <label class="inline-flex items-center"> |
| <input type="radio" name="fbs" value="0" class="form-radio text-rose-500" required> |
| <span class="ml-2">No</span> |
| </label> |
| <label class="inline-flex items-center"> |
| <input type="radio" name="fbs" value="1" class="form-radio text-rose-500"> |
| <span class="ml-2">Yes</span> |
| </label> |
| </div> |
| </div> |
| </div> |
|
|
| <div class="space-y-4"> |
| <div> |
| <label class="block text-gray-700 font-medium mb-2">Resting ECG</label> |
| <select name="restecg" required class="w-full px-4 py-2 rounded-lg border border-gray-300 input-field focus:outline-none"> |
| <option value="">Select result</option> |
| <option value="0">0 - Normal</option> |
| <option value="1">1 - ST-T wave abnormality</option> |
| <option value="2">2 - Left ventricular hypertrophy</option> |
| </select> |
| </div> |
| <div> |
| <label class="block text-gray-700 font-medium mb-2">Max Heart Rate</label> |
| <input type="number" step="0.1" name="thalach" required |
| class="w-full px-4 py-2 rounded-lg border border-gray-300 input-field focus:outline-none"> |
| </div> |
| <div> |
| <label class="block text-gray-700 font-medium mb-2">Exercise Induced Angina</label> |
| <div class="flex space-x-4"> |
| <label class="inline-flex items-center"> |
| <input type="radio" name="exang" value="0" class="form-radio text-rose-500" required> |
| <span class="ml-2">No</span> |
| </label> |
| <label class="inline-flex items-center"> |
| <input type="radio" name="exang" value="1" class="form-radio text-rose-500"> |
| <span class="ml-2">Yes</span> |
| </label> |
| </div> |
| </div> |
| <div> |
| <label class="block text-gray-700 font-medium mb-2">ST Depression</label> |
| <input type="number" step="0.01" name="oldpeak" required |
| class="w-full px-4 py-2 rounded-lg border border-gray-300 input-field focus:outline-none"> |
| </div> |
| <div> |
| <label class="block text-gray-700 font-medium mb-2">Slope of ST Segment</label> |
| <select name="slope" required class="w-full px-4 py-2 rounded-lg border border-gray-300 input-field focus:outline-none"> |
| <option value="">Select slope</option> |
| <option value="0">0 - Upsloping</option> |
| <option value="1">1 - Flat</option> |
| <option value="2">2 - Downsloping</option> |
| </select> |
| </div> |
| <div> |
| <label class="block text-gray-700 font-medium mb-2">Number of Major Vessels</label> |
| <input type="number" step="1" name="ca" min="0" max="3" required |
| class="w-full px-4 py-2 rounded-lg border border-gray-300 input-field focus:outline-none"> |
| </div> |
| </div> |
|
|
| <div class="md:col-span-2"> |
| <label class="block text-gray-700 font-medium mb-2">Thalassemia</label> |
| <select name="thal" required class="w-full px-4 py-2 rounded-lg border border-gray-300 input-field focus:outline-none"> |
| <option value="">Select type</option> |
| <option value="1">1 - Normal</option> |
| <option value="2">2 - Fixed defect</option> |
| <option value="3">3 - Reversible defect</option> |
| </select> |
| </div> |
|
|
| <div class="md:col-span-2 flex justify-center"> |
| <button type="submit" |
| class="gradient-bg text-white font-bold py-3 px-8 rounded-full hover:opacity-90 transition-all shadow-lg pulse-animation"> |
| <div class="flex items-center space-x-2"> |
| <i data-feather="activity" class="w-5 h-5"></i> |
| <span>Predict Heart Disease Risk</span> |
| </div> |
| </button> |
| </div> |
| </form> |
|
|
| {% if prediction %} |
| <div class="px-6 pb-6"> |
| <div class="border-t border-gray-200 pt-6"> |
| <h3 class="text-xl font-bold text-gray-800 mb-4">Prediction Result</h3> |
| <div class="p-4 rounded-lg bg-rose-50 border border-rose-100"> |
| <div class="flex items-start"> |
| <div class="flex-shrink-0"> |
| <i data-feather="alert-circle" class="w-6 h-6 text-rose-600"></i> |
| </div> |
| <div class="ml-3"> |
| <h4 class="text-lg font-medium text-rose-800">{{ "High Risk" if prediction == 1 else "Low Risk" }}</h4> |
| <p class="mt-1 text-sm text-rose-700"> |
| {{ "The patient shows signs of potential heart disease. Please consult a cardiologist." |
| if prediction == 1 |
| else "The patient shows no significant signs of heart disease. Regular checkups are recommended." }} |
| </p> |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |
| {% endif %} |
| </div> |
| </main> |
|
|
| <footer class="gradient-bg text-white py-8"> |
| <div class="container mx-auto px-4 text-center"> |
| <div class="flex justify-center space-x-6 mb-4"> |
| <a href="#" class="hover:text-rose-200"><i data-feather="twitter"></i></a> |
| <a href="#" class="hover:text-rose-200"><i data-feather="facebook"></i></a> |
| <a href="#" class="hover:text-rose-200"><i data-feather="linkedin"></i></a> |
| <a href="#" class="hover:text-rose-200"><i data-feather="github"></i></a> |
| </div> |
| <p class="text-sm opacity-80">© 2023 HeartGuardian. All rights reserved.</p> |
| <p class="text-xs mt-2 opacity-60">Disclaimer: This tool is for informational purposes only and not a substitute for professional medical advice.</p> |
| </div> |
| </footer> |
| </div> |
|
|
| <script> |
| feather.replace(); |
| VANTA.NET({ |
| el: "#vanta-bg", |
| color: 0xf43f5e, |
| backgroundColor: 0xf8fafc, |
| points: 8, |
| maxDistance: 20, |
| spacing: 15 |
| }); |
| </script> |
| </body> |
| </html> |
|
|