testing / app.py
vijay399's picture
Update app.py
0c98e15
raw
history blame contribute delete
642 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):
resultValue, exception = Paraphrase.paraphraseParaphraseMethod(text)
return {"request": text, "result": resultValue, "exception": exception}
@app.get("/translate")
def translate(text: str):
resultValue, exception = Translate.paraphraseTranslateMethod(text)
return {"request": text, "result": resultValue, "exception": exception}