Spaces:
Sleeping
Sleeping
Update index.html
Browse files- index.html +36 -37
index.html
CHANGED
@@ -7,81 +7,80 @@
|
|
7 |
<style>
|
8 |
body {
|
9 |
font-family: Arial, sans-serif;
|
10 |
-
background-color: #f0f2f6;
|
11 |
text-align: center;
|
|
|
12 |
padding: 20px;
|
13 |
}
|
14 |
.container {
|
|
|
15 |
background: white;
|
16 |
padding: 20px;
|
17 |
-
border-radius:
|
18 |
-
box-shadow:
|
19 |
-
max-width: 500px;
|
20 |
margin: auto;
|
21 |
}
|
22 |
-
|
23 |
width: 100%;
|
24 |
padding: 10px;
|
25 |
margin: 10px 0;
|
26 |
border-radius: 5px;
|
27 |
border: 1px solid #ccc;
|
28 |
}
|
29 |
-
.response-box {
|
30 |
-
background-color: #e3f2fd;
|
31 |
-
padding: 15px;
|
32 |
-
border-radius: 8px;
|
33 |
-
margin-top: 10px;
|
34 |
-
}
|
35 |
button {
|
36 |
-
padding: 10px
|
37 |
-
|
38 |
-
background: #2E7D32;
|
39 |
color: white;
|
40 |
-
border
|
41 |
cursor: pointer;
|
|
|
42 |
}
|
43 |
button:hover {
|
44 |
-
background: #
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
</style>
|
47 |
</head>
|
48 |
<body>
|
|
|
49 |
<div class="container">
|
50 |
<h1>🩺 Health Disease Chatbot</h1>
|
51 |
<p>Enter a question related to health conditions, symptoms, or treatments.</p>
|
52 |
-
<input type="text" id="query"
|
53 |
<button onclick="getResponse()">Get Information</button>
|
54 |
-
<div id="response" class="response
|
55 |
</div>
|
56 |
-
|
57 |
<script>
|
58 |
async function getResponse() {
|
59 |
-
|
60 |
if (!query) {
|
61 |
-
alert("Please enter a query
|
62 |
return;
|
63 |
}
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
try {
|
70 |
-
|
71 |
method: "POST",
|
72 |
-
headers: {
|
73 |
-
|
74 |
-
},
|
75 |
-
body: JSON.stringify({ query })
|
76 |
});
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
} catch (error) {
|
81 |
-
|
82 |
-
responseBox.style.display = 'block';
|
83 |
}
|
84 |
}
|
85 |
</script>
|
|
|
86 |
</body>
|
87 |
-
</html>
|
|
|
7 |
<style>
|
8 |
body {
|
9 |
font-family: Arial, sans-serif;
|
|
|
10 |
text-align: center;
|
11 |
+
background-color: #f0f2f6;
|
12 |
padding: 20px;
|
13 |
}
|
14 |
.container {
|
15 |
+
max-width: 600px;
|
16 |
background: white;
|
17 |
padding: 20px;
|
18 |
+
border-radius: 10px;
|
19 |
+
box-shadow: 2px 2px 10px rgba(0,0,0,0.1);
|
|
|
20 |
margin: auto;
|
21 |
}
|
22 |
+
input {
|
23 |
width: 100%;
|
24 |
padding: 10px;
|
25 |
margin: 10px 0;
|
26 |
border-radius: 5px;
|
27 |
border: 1px solid #ccc;
|
28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
button {
|
30 |
+
padding: 10px 20px;
|
31 |
+
background-color: #2E7D32;
|
|
|
32 |
color: white;
|
33 |
+
border: none;
|
34 |
cursor: pointer;
|
35 |
+
border-radius: 5px;
|
36 |
}
|
37 |
button:hover {
|
38 |
+
background-color: #256a2c;
|
39 |
+
}
|
40 |
+
.response {
|
41 |
+
margin-top: 20px;
|
42 |
+
background: #ffffff;
|
43 |
+
padding: 15px;
|
44 |
+
border-radius: 8px;
|
45 |
+
box-shadow: 2px 2px 10px rgba(0,0,0,0.1);
|
46 |
}
|
47 |
</style>
|
48 |
</head>
|
49 |
<body>
|
50 |
+
|
51 |
<div class="container">
|
52 |
<h1>🩺 Health Disease Chatbot</h1>
|
53 |
<p>Enter a question related to health conditions, symptoms, or treatments.</p>
|
54 |
+
<input type="text" id="query" placeholder="Enter your query...">
|
55 |
<button onclick="getResponse()">Get Information</button>
|
56 |
+
<div id="response" class="response"></div>
|
57 |
</div>
|
58 |
+
|
59 |
<script>
|
60 |
async function getResponse() {
|
61 |
+
let query = document.getElementById("query").value;
|
62 |
if (!query) {
|
63 |
+
alert("Please enter a query!");
|
64 |
return;
|
65 |
}
|
66 |
+
|
67 |
+
let responseDiv = document.getElementById("response");
|
68 |
+
responseDiv.innerHTML = "Processing...";
|
69 |
+
|
|
|
70 |
try {
|
71 |
+
let response = await fetch("/query", {
|
72 |
method: "POST",
|
73 |
+
headers: { "Content-Type": "application/json" },
|
74 |
+
body: JSON.stringify({ query: query })
|
|
|
|
|
75 |
});
|
76 |
+
|
77 |
+
let data = await response.json();
|
78 |
+
responseDiv.innerHTML = `<b>Response:</b><br> ${data.response}`;
|
79 |
} catch (error) {
|
80 |
+
responseDiv.innerHTML = "Error fetching response.";
|
|
|
81 |
}
|
82 |
}
|
83 |
</script>
|
84 |
+
|
85 |
</body>
|
86 |
+
</html>
|