File size: 412 Bytes
7028ae7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from rpunct import RestorePuncts
print("Loading Model...")
rpunct = RestorePuncts()

from fastapi import FastAPI

app = FastAPI()
print("Models loaded !")

@app.get("/")
def read_root():
    return {"Homepage!"}

@app.get("/{restore}")
def get_correction(input_sentence):
    '''Returns sentence with correct punctuations and case'''
    return {"corrected_sentence": rpunct.punctuate(input_sentence, lang="en")}