File size: 438 Bytes
b295d62
 
 
c4d5641
83ec4f2
b295d62
 
 
83ec4f2
 
b295d62
 
83ec4f2
b295d62
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles

from models import CheckResponse
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))

app.mount("/", StaticFiles(directory="frontend/public", html=True))