TiberiuCristianLeon commited on
Commit
42c14b6
·
verified ·
1 Parent(s): 53869cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -37,13 +37,13 @@ def index(request: Request):
37
  # host_url = request.url.scheme + "://" + request.url.netloc
38
  # return {"host_url": host_url, 'endpoints': ['/paraphrase', '/translate', f'{host_url}/docs', f'{host_url}/redoc', f'{host_url}/openapi.json'], 'mtmodels': MTMODELS}
39
 
40
- @app.get("/paraphrase")
41
- def paraphrase(text: str, model: str, operation_id="get_paraphrase", description="Paraphrase text", tags=["paraphrase"], summary="Paraphrase text"):
42
  resultValue, exception = Paraphrase.paraphraseParaphraseMethod(text, model)
43
  return {"input": text, "translation": resultValue, "exception": exception}
44
 
45
- @app.get("/translate")
46
- def translate(text: str, model: Optional[str] = MTMODELS['gemma'], operation_id="get_translate", description="Translate text", tags=["translate"], summary="Translate text"):
47
  # resultValue, exception = Translate.paraphraseTranslateMethod(text, model)
48
  resultValue: str = Translate.gemma_direct(text, model)
49
  return {"input": text, "result": resultValue, "model": model}
 
37
  # host_url = request.url.scheme + "://" + request.url.netloc
38
  # return {"host_url": host_url, 'endpoints': ['/paraphrase', '/translate', f'{host_url}/docs', f'{host_url}/redoc', f'{host_url}/openapi.json'], 'mtmodels': MTMODELS}
39
 
40
+ @app.get("/paraphrase", operation_id="get_paraphrase", description="Paraphrase text", tags=["paraphrase"], summary="Paraphrase text")
41
+ def paraphrase(text: str, model: str):
42
  resultValue, exception = Paraphrase.paraphraseParaphraseMethod(text, model)
43
  return {"input": text, "translation": resultValue, "exception": exception}
44
 
45
+ @app.get("/translate", operation_id="get_translate", description="Translate text", tags=["translate"], summary="Translate text")
46
+ def translate(text: str, model: Optional[str] = MTMODELS['gemma']):
47
  # resultValue, exception = Translate.paraphraseTranslateMethod(text, model)
48
  resultValue: str = Translate.gemma_direct(text, model)
49
  return {"input": text, "result": resultValue, "model": model}