Spaces:
Sleeping
Sleeping
DmitrMakeev
commited on
Commit
•
4595fee
1
Parent(s):
5a92c3d
Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,41 @@ import globs
|
|
10 |
from flask import render_template
|
11 |
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
from api_logic import api
|
14 |
|
15 |
|
@@ -241,6 +276,55 @@ def handle_save_db():
|
|
241 |
def graf_json():
|
242 |
return render_template('graf.html')
|
243 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
|
245 |
|
246 |
|
|
|
10 |
from flask import render_template
|
11 |
|
12 |
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
|
28 |
+
|
29 |
+
from fastapi import FastAPI
|
30 |
+
from fastapi.websockets import WebSocket
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
+
|
48 |
from api_logic import api
|
49 |
|
50 |
|
|
|
276 |
def graf_json():
|
277 |
return render_template('graf.html')
|
278 |
|
279 |
+
|
280 |
+
|
281 |
+
|
282 |
+
|
283 |
+
|
284 |
+
|
285 |
+
|
286 |
+
|
287 |
+
|
288 |
+
|
289 |
+
|
290 |
+
|
291 |
+
|
292 |
+
|
293 |
+
|
294 |
+
|
295 |
+
|
296 |
+
|
297 |
+
|
298 |
+
|
299 |
+
|
300 |
+
app = FastAPI()
|
301 |
+
|
302 |
+
@app.websocket("/ws")
|
303 |
+
async def websocket_endpoint(websocket: WebSocket):
|
304 |
+
await websocket.accept()
|
305 |
+
while True:
|
306 |
+
data = await websocket.receive_text()
|
307 |
+
await websocket.send_text(f"You said: {data}")
|
308 |
+
|
309 |
+
|
310 |
+
|
311 |
+
|
312 |
+
|
313 |
+
|
314 |
+
|
315 |
+
|
316 |
+
|
317 |
+
|
318 |
+
|
319 |
+
|
320 |
+
|
321 |
+
|
322 |
+
|
323 |
+
|
324 |
+
|
325 |
+
|
326 |
+
|
327 |
+
|
328 |
|
329 |
|
330 |
|