File size: 523 Bytes
b295d62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from pydantic import BaseModel

class Word(BaseModel):
    word: str
    start: int
    end: int
    logprob: float
    suggestions: list[str]

class CheckResponse(BaseModel):
    text: str
    words: list[Word]

app = FastAPI()

@app.get("/check", response_model=CheckResponse)
def check(text: str):
    return CheckResponse(text=text, words=[])

# serve files from frontend/public
app.mount("/", StaticFiles(directory="frontend/public", html=True))