Spaces:
Paused
Paused
DaniilAlpha
commited on
Commit
·
80d5fe0
1
Parent(s):
4cec5d2
Update main.py
Browse files
main.py
CHANGED
@@ -1,5 +1,6 @@
|
|
|
|
1 |
from fastapi import FastAPI, WebSocket
|
2 |
-
from fastapi.responses import HTMLResponse
|
3 |
|
4 |
from answerer import Answerer
|
5 |
from mapper import Mapper
|
@@ -61,8 +62,9 @@ def index():
|
|
61 |
return HTMLResponse(HTML)
|
62 |
|
63 |
@app.get("/map")
|
64 |
-
def map():
|
65 |
-
|
|
|
66 |
|
67 |
@app.websocket("/answer")
|
68 |
async def answer(ws: WebSocket):
|
|
|
1 |
+
from typing import List, Union
|
2 |
from fastapi import FastAPI, WebSocket
|
3 |
+
from fastapi.responses import HTMLResponse, JSONResponse
|
4 |
|
5 |
from answerer import Answerer
|
6 |
from mapper import Mapper
|
|
|
62 |
return HTMLResponse(HTML)
|
63 |
|
64 |
@app.get("/map")
|
65 |
+
def map(query: str, items: List[str]):
|
66 |
+
indices = mapper(query, items)
|
67 |
+
return JSONResponse(indices)
|
68 |
|
69 |
@app.websocket("/answer")
|
70 |
async def answer(ws: WebSocket):
|