File size: 513 Bytes
b295d62 83ec4f2 b295d62 83ec4f2 b295d62 83ec4f2 b295d62 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from pydantic import BaseModel
from models import CheckResponse, ApiWord
from completions import check_text, load_model
app = FastAPI()
model, tokenizer, device = load_model()
@app.get("/check", response_model=CheckResponse)
def check(text: str):
return CheckResponse(text=text, words=check_text(text, model, tokenizer, device))
# serve files from frontend/public
app.mount("/", StaticFiles(directory="frontend/public", html=True))
|