Spyke

Replies

Comment on

Offline Translator: An Android translator app that performs text and image translation completely offline using on-device models—Supports automatic language detection

Reply in thread

Yeah, I use it as well and the level of translation is simmilar to the level of google translate in the early 2010s. The main problem it has is that the OCR is not great. It can only detect very clear horizontal texts and has problems in any other use case. Also it gives you a translation but no alternatives that might be good depending on the context but I think that might be outside the scope of this model.

Comment on

write to variable with fetch api before rest of script executes (client side)

If you want to continue in the same function you'll need to use async/await. In your case:

async function yourFunctionName(){
    // previous logic
    const myVar = await fetch("myFile.json")
        .then(res => res.json());
    console.log(myVar);
    //rest of code executes...
}

Realize that you have to add async to your function and await to your fetch call. Also take into account that if your function returns anything, it'll now return a Promise instead.

You reached the end