modelSelector.js 462 B

123456789101112131415161718192021222324252627
  1. /*
  2. modelSelector.js
  3. Handle neural network selection
  4. Require paramters:
  5. set
  6. model (Require when set = true)
  7. */
  8. includes("imagedb.js");
  9. function GetCurrentModel(){
  10. return getNNModel();
  11. }
  12. function SetClassifyModel(newModel){
  13. setNNModel(newModel);
  14. sendJSONResp(JSON.stringify("OK"));
  15. }
  16. if (typeof(set) == "undefined"){
  17. //Get
  18. sendJSONResp(JSON.stringify(GetCurrentModel()));
  19. }else{
  20. //Set
  21. SetClassifyModel(model);
  22. }