infinitered/nsfwjs

Supporting model load from indexeddb

Open

#430 opened on Oct 24, 2020

View on GitHub
 (2 comments) (0 reactions) (0 assignees)JavaScript (507 forks)batch import
Browser Issuesgood first issuehelp wanted

Repository metrics

Stars
 (7,090 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

https://github.com/infinitered/nsfwjs/blob/ebcd41c46087a3f42c6577f96acc53d7a934b068/src/index.ts#L68

Hello, it seems, although not explicit I can save the model to different schemas by referencing the underlying "model" attribute in the model returned by nsfwjs.load() e.g.

nsfwjs.load(path).then(function (newModel) { console.log("path", path); if(newModel) { newModel.model.save('indexeddb://' + SOME_KEY); } }).catch(error => { console.error('onRejected function called: ' + error.message); })

However, I am unable to then reload the model from say an indexeddb location using:

nsfwjs.load('indexeddb://' + SOME_KEY) as the line above in the code just checks for a string, assumes it's a url or relative path, rather than another schema location and them appends 'model.js'.

I think tf.js supports loading and saving to other schemas, it'd be cool if NSFWJS followed suit ...

Contributor guide