|
<!DOCTYPE html> |
|
<html lang="en"> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
<title>Medical Report Summarizer</title> |
|
<style> |
|
body { |
|
font-family: Arial, sans-serif; |
|
background-color: #f4f4f4; |
|
display: flex; |
|
justify-content: center; |
|
align-items: center; |
|
height: 100vh; |
|
margin: 0; |
|
} |
|
.container { |
|
background: white; |
|
padding: 20px; |
|
border-radius: 8px; |
|
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); |
|
width: 400px; |
|
} |
|
h1 { |
|
text-align: center; |
|
margin-bottom: 20px; |
|
} |
|
input[type="file"] { |
|
width: 100%; |
|
margin-bottom: 20px; |
|
} |
|
button { |
|
width: 100%; |
|
padding: 10px; |
|
background-color: #007bff; |
|
color: white; |
|
border: none; |
|
border-radius: 5px; |
|
cursor: pointer; |
|
} |
|
button:hover { |
|
background-color: #0056b3; |
|
} |
|
.result { |
|
margin-top: 20px; |
|
padding: 10px; |
|
background: #e9ecef; |
|
border-radius: 5px; |
|
display: none; |
|
} |
|
</style> |
|
</head> |
|
<body> |
|
<div class="container"> |
|
<h1>Medical Report Summarizer</h1> |
|
<form id="reportForm" enctype="multipart/form-data"> |
|
<input type="file" id="report" name="report" accept=".pdf,.doc,.docx" required /> |
|
<button type="submit">Summarize Report</button> |
|
</form> |
|
<div class="result" id="summaryResult"></div> |
|
</div> |
|
|
|
<script> |
|
document.getElementById('reportForm').onsubmit = async function (event) { |
|
event.preventDefault(); |
|
const formData = new FormData(); |
|
const fileInput = document.getElementById('report'); |
|
|
|
formData.append('report', fileInput.files[0]); |
|
|
|
const response = await fetch('/summarize', { |
|
method: 'POST', |
|
body: formData |
|
}); |
|
|
|
if (response.ok) { |
|
const summary = await response.text(); |
|
const resultDiv = document.getElementById('summaryResult'); |
|
resultDiv.textContent = summary; |
|
resultDiv.style.display = 'block'; |
|
} else { |
|
alert('Error summarizing the report.'); |
|
} |
|
}; |
|
</script> |
|
</body> |
|
</html> |
|
|