TiberiuCristianLeon commited on
Commit
fd2637b
·
verified ·
1 Parent(s): 7d8d2f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -5,17 +5,18 @@ import nltk
5
  nltk.download('punkt')
6
 
7
  app = FastAPI(docs_url="/")
 
8
 
9
  @app.get("/")
10
  def index():
11
- return {"output": "HELLO!!!"}
12
 
13
  @app.get("/paraphrase")
14
  def paraphrase(text: str, model: str):
15
  resultValue, exception = Paraphrase.paraphraseParaphraseMethod(text, model)
16
- return {"request": text, "result": resultValue, "exception": exception}
17
 
18
  @app.get("/translate")
19
  def translate(text: str, model: str):
20
  resultValue, exception = Translate.paraphraseTranslateMethod(text, model)
21
- return {"request": text, "result": resultValue, "exception": exception}
 
5
  nltk.download('punkt')
6
 
7
  app = FastAPI(docs_url="/")
8
+ MTMODELS = {'enro': 'BlackKakapo/opus-mt-en-ro', 'roen': 'BlackKakapo/opus-mt-ro-en'}
9
 
10
  @app.get("/")
11
  def index():
12
+ return {"endpoints": ['/paraphrase', '/translate']. 'mtmodels': MTMODELS}
13
 
14
  @app.get("/paraphrase")
15
  def paraphrase(text: str, model: str):
16
  resultValue, exception = Paraphrase.paraphraseParaphraseMethod(text, model)
17
+ return {"input": text, "translation": resultValue, "exception": exception}
18
 
19
  @app.get("/translate")
20
  def translate(text: str, model: str):
21
  resultValue, exception = Translate.paraphraseTranslateMethod(text, model)
22
+ return {"input": text, "translation": resultValue, "exception": exception}