Spaces:
Paused
Paused
Commit
·
bc2d927
1
Parent(s):
aeb5107
Update main.py
Browse files
main.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
from typing import Union
|
| 2 |
from fastapi import FastAPI
|
| 3 |
from fastapi.encoders import jsonable_encoder
|
|
@@ -61,14 +62,15 @@ HTML = """
|
|
| 61 |
</html>
|
| 62 |
"""
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
|
| 68 |
@app.websocket("/accelerate")
|
| 69 |
async def answer(ws: WebSocket):
|
| 70 |
await ws.accept()
|
| 71 |
accelerator = ws
|
|
|
|
| 72 |
|
| 73 |
@app.post("/map")
|
| 74 |
def map(query: Union[str, None], items: Union[list[str], None]):
|
|
|
|
| 1 |
+
from asyncio import sleep
|
| 2 |
from typing import Union
|
| 3 |
from fastapi import FastAPI
|
| 4 |
from fastapi.encoders import jsonable_encoder
|
|
|
|
| 62 |
</html>
|
| 63 |
"""
|
| 64 |
|
| 65 |
+
@app.get("/")
|
| 66 |
+
def index():
|
| 67 |
+
return HTMLResponse(HTML)
|
| 68 |
|
| 69 |
@app.websocket("/accelerate")
|
| 70 |
async def answer(ws: WebSocket):
|
| 71 |
await ws.accept()
|
| 72 |
accelerator = ws
|
| 73 |
+
while True: await sleep(60)
|
| 74 |
|
| 75 |
@app.post("/map")
|
| 76 |
def map(query: Union[str, None], items: Union[list[str], None]):
|