FastAPIMT / app.py
TiberiuCristianLeon's picture
Update app.py
9f45cd5 verified
raw
history blame
680 Bytes
from fastapi import FastAPI
import src.paraphrase.Paraphrase as Paraphrase
import src.translate.Translate as Translate
import nltk
nltk.download('punkt')
app = FastAPI(docs_url="/")
@app.get("/")
def index():
return {"output": "HELLO!!!"}
@app.get("/paraphrase")
def paraphrase(text: str, model: str):
resultValue, exception = Paraphrase.paraphraseParaphraseMethod(text, model)
return {"request": text, "result": resultValue, "exception": exception}
@app.get("/translate")
def translate(text: str, model: str):
resultValue, exception = Translate.paraphraseTranslateMethod(text, model)
return {"request": text, "result": resultValue, "exception": exception}