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")}