File size: 680 Bytes
d120873
 
 
 
 
 
 
 
 
 
 
 
 
2130cf2
9f45cd5
d120873
 
 
2130cf2
9f45cd5
0c98e15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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}