Omkar1872's picture
Update templates/index.html
d7a2701 verified
<!DOCTYPE html>
<html>
<head>
<title>Pneumonia Detection from Chest X-ray</title>
</head>
<body>
<h1>Pneumonia Detection from Chest X-ray</h1>
<p>Upload an X-ray image to check for Pneumonia</p>
<form id="upload-form">
<input type="file" id="file" name="file" accept="image/*" required>
<button type="submit">Detect</button>
</form>
<p id="result"></p>
<script>
const form = document.getElementById('upload-form');
const result = document.getElementById('result');
form.addEventListener('submit', async (e) => {
e.preventDefault();
const fileInput = document.getElementById('file');
const formData = new FormData();
formData.append('file', fileInput.files[0]);
const response = await fetch('/predict', {
method: 'POST',
body: formData
});
const data = await response.json();
result.innerText = `Result: ${data.result}`;
});
</script>
</body>
</html>