OWASP / OpenCRE

https://opencre.org
Creative Commons Zero v1.0 Universal
81 stars 33 forks source link

Suggest mappings #547

Open northdpole opened 3 months ago

northdpole commented 3 months ago

This pr introduces a new endpoint which accepts a csv in the import format with lines that do not have a CRE and uses embeddings to fill the missing cres with a suggestion.

You can test this pr as follows:

# sync from upstream
python cre.py --upstream_sync  

# generate embeddings, WARNING if you want any sort of accuracy you should use an LLM instead of spacy which is for local unit tests only
python cre.py --generate_embeddings 

# run the web server
make dev-flask

# on another terminal
curl -X POST http://localhost:5000/rest/v1/cre_csv/suggest -F "cre_csv=@< csv file that follows the export format but does not necessarily have cres>"