restore-punctuation-demo / InferenceServer.py
anuragshas's picture
added files
7028ae7
raw
history blame
412 Bytes
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")}