Search on legal documents using Tensorflow and a web_actix web interface
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
741 B

3 years ago
1 year ago
3 years ago
  1. from fastapi import FastAPI, Response, Request
  2. from fastapi.responses import JSONResponse
  3. app = FastAPI()
  4. from updateDatabase import *
  5. pluriDBupdater = PluritonUpdater()
  6. pluriDBupdater.loadModels()
  7. @app.post("/datext", response_class=JSONResponse)
  8. async def root(data: Request):
  9. text_bytes = await data.body()
  10. text = str(text_bytes)
  11. print(text)
  12. text_lower = text.lower()
  13. einfach, schwer = pluriDBupdater.searchNearest2Translate(text_lower)
  14. einfachstr = ''
  15. schwerstr = ''
  16. for word in einfach:
  17. einfachstr += word + ' '
  18. for word in schwer:
  19. schwerstr += word + ' '
  20. daresponse = einfachstr + '?&?&' + schwerstr
  21. return JSONResponse(content=daresponse)