Update app.py
Browse files
app.py
CHANGED
@@ -189,12 +189,72 @@ html_code = """
|
|
189 |
<html>
|
190 |
<head>
|
191 |
<title>Chatbot</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
</head>
|
193 |
<body>
|
194 |
-
<
|
195 |
-
|
196 |
-
|
197 |
-
|
|
|
|
|
198 |
|
199 |
<script>
|
200 |
function sendMessage() {
|
@@ -230,7 +290,5 @@ async def root():
|
|
230 |
if __name__ == "__main__":
|
231 |
initialize_redis()
|
232 |
import asyncio
|
233 |
-
uvicorn.run(app, host="0.0.0.0", port=7860)
|
234 |
-
|
235 |
-
loop = asyncio.get_event_loop() # Get the current event loop
|
236 |
-
loop.create_task(train_and_save_model()) # Create the training task within the loop
|
|
|
189 |
<html>
|
190 |
<head>
|
191 |
<title>Chatbot</title>
|
192 |
+
<style>
|
193 |
+
body {
|
194 |
+
font-family: sans-serif;
|
195 |
+
background-color: #f4f4f4;
|
196 |
+
margin: 0;
|
197 |
+
padding: 0;
|
198 |
+
display: flex;
|
199 |
+
justify-content: center;
|
200 |
+
align-items: center;
|
201 |
+
min-height: 100vh;
|
202 |
+
}
|
203 |
+
|
204 |
+
#container {
|
205 |
+
background-color: #fff;
|
206 |
+
border-radius: 5px;
|
207 |
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
208 |
+
padding: 30px;
|
209 |
+
width: 80%;
|
210 |
+
max-width: 600px;
|
211 |
+
}
|
212 |
+
|
213 |
+
h1 {
|
214 |
+
text-align: center;
|
215 |
+
margin-bottom: 20px;
|
216 |
+
color: #333;
|
217 |
+
}
|
218 |
+
|
219 |
+
#chatbox {
|
220 |
+
height: 300px;
|
221 |
+
overflow-y: auto;
|
222 |
+
padding: 10px;
|
223 |
+
border: 1px solid #ccc;
|
224 |
+
border-radius: 5px;
|
225 |
+
margin-bottom: 10px;
|
226 |
+
}
|
227 |
+
|
228 |
+
#chatbox p {
|
229 |
+
margin: 5px 0;
|
230 |
+
}
|
231 |
+
|
232 |
+
#user_input {
|
233 |
+
width: 100%;
|
234 |
+
padding: 10px;
|
235 |
+
border: 1px solid #ccc;
|
236 |
+
border-radius: 5px;
|
237 |
+
margin-bottom: 10px;
|
238 |
+
box-sizing: border-box;
|
239 |
+
}
|
240 |
+
|
241 |
+
button {
|
242 |
+
background-color: #4CAF50;
|
243 |
+
color: white;
|
244 |
+
padding: 10px 20px;
|
245 |
+
border: none;
|
246 |
+
border-radius: 5px;
|
247 |
+
cursor: pointer;
|
248 |
+
}
|
249 |
+
</style>
|
250 |
</head>
|
251 |
<body>
|
252 |
+
<div id="container">
|
253 |
+
<h1>Chatbot</h1>
|
254 |
+
<div id="chatbox"></div>
|
255 |
+
<input type="text" id="user_input" placeholder="Type your message...">
|
256 |
+
<button onclick="sendMessage()">Send</button>
|
257 |
+
</div>
|
258 |
|
259 |
<script>
|
260 |
function sendMessage() {
|
|
|
290 |
if __name__ == "__main__":
|
291 |
initialize_redis()
|
292 |
import asyncio
|
293 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|
294 |
+
asyncio.run(train_and_save_model())
|
|
|
|