HealthCare-Chatbot / index.html
rohitashva's picture
Update index.html
54222a1 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Health Disease Chatbot</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
background-color: #f0f2f6;
padding: 20px;
}
.container {
max-width: 600px;
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 2px 2px 10px rgba(0,0,0,0.1);
margin: auto;
}
input {
width: 100%;
padding: 10px;
margin: 10px 0;
border-radius: 5px;
border: 1px solid #ccc;
}
button {
padding: 10px 20px;
background-color: #2E7D32;
color: white;
border: none;
cursor: pointer;
border-radius: 5px;
}
button:hover {
background-color: #256a2c;
}
.response {
margin-top: 20px;
background: #ffffff;
padding: 15px;
border-radius: 8px;
box-shadow: 2px 2px 10px rgba(0,0,0,0.1);
}
</style>
</head>
<body>
<div class="container">
<h1>🩺 Health Disease Chatbot</h1>
<p>Enter a question related to health conditions, symptoms, or treatments.</p>
<input type="text" id="query" placeholder="Enter your query...">
<button onclick="getResponse()">Get Information</button>
<div id="response" class="response"></div>
</div>
<script>
async function getResponse() {
let query = document.getElementById("query").value;
if (!query) {
alert("Please enter a query!");
return;
}
let responseDiv = document.getElementById("response");
responseDiv.innerHTML = "Processing...";
try {
let response = await fetch("/query", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ query: query })
});
let data = await response.json();
responseDiv.innerHTML = `<b>Response:</b><br> ${data.response}`;
} catch (error) {
responseDiv.innerHTML = "Error fetching response.";
}
}
</script>
</body>
</html>