Giter Site home page Giter Site logo

working example? about vosklet HOT 9 CLOSED

korabelnikov avatar korabelnikov commented on June 16, 2024
working example?

from vosklet.

Comments (9)

msqr1 avatar msqr1 commented on June 16, 2024

Make sure you have your URL (en-model.tgz) to point to a valid one. The one on the example should be in the examples folder. You can download the model and place it in the directory of the HTML file, or you can replace it with https://github.com/msqr1/Vosklet/raw/main/examples/en-model.tgz to fetch it directly from github

from vosklet.

korabelnikov avatar korabelnikov commented on June 16, 2024

Make sure you have your URL (en-model.tgz) to point to a valid one. The one on the example should be in the examples folder. You can download the model and place it in the directory of the HTML file, or you can replace it with https://github.com/msqr1/Vosklet/raw/main/examples/en-model.tgz to fetch it directly from github

Thank you, for a quick response, unfortunately, the accessibility of the model files is not a case.

127.0.0.1 - - [13/May/2024 10:10:18] "GET /static/Vosklet.js HTTP/1.1" 304 -
127.0.0.1 - - [13/May/2024 10:10:28] "GET /static/en-model.tgz HTTP/1.1" 200 -

I digged in a bit, an error arise at
tar = await new Response(tar.pipeThrough(new DecompressionStream("gzip"))).arrayBuffer();
at the call of arrayBuffer()

from vosklet.

korabelnikov avatar korabelnikov commented on June 16, 2024

I found out, that browser extract gzipped stream on the fly, I removed content-type of model.tgz to avoid this

usage of https://github.com/msqr1/Vosklet/raw/main/examples/en-model.tgz seems impossible due to CORS restrictions, so I still use my local file

from vosklet.

korabelnikov avatar korabelnikov commented on June 16, 2024

removing gzip piping from Vosklet.js works

from vosklet.

jakespracher avatar jakespracher commented on June 16, 2024

Ah crap I am hitting this too.

removing gzip piping from Vosklet.js works

@msqr1 should this be removed from the lib? Or maybe the case where the browser decompressed the file should be handled as a special case?

from vosklet.

msqr1 avatar msqr1 commented on June 16, 2024

Basically, for faster load times, I store a gzipped copy of the model in OPFS. OPFS is not fetchable, so I have to manually decompress it before loading. To do this, the first time a model is fetched, we receive a compressed model, tee the stream so that one (still compressed) goes into OPFS, and one (get decompressed) goes to model loading. If the browser decompress beforehand, I have to compress before storage (to save space), which I think is slower than decompressing.

A solution I think for this would be doing this would be letting the browser decompress, and compress again (1st time cost only) to store it, and proceed as normal.

from vosklet.

jakespracher avatar jakespracher commented on June 16, 2024

Basically, for faster load times, I store a gzipped copy of the model in OPFS. OPFS is not fetchable, so I have to manually decompress it before loading. To do this, the first time a model is fetched, we receive a compressed model, tee the stream so that one (still compressed) goes into OPFS, and one (get decompressed) goes to model loading. If the browser decompress beforehand, I have to compress before storage (to save space), which I think is slower than decompressing.

A solution I think for this would be doing this would be letting the browser decompress, and compress again (1st time cost only) to store it, and proceed as normal.

This would be internal within the library, right? I don't have full context since I'm not familiar with the codebase but that sounds reasonable to me

from vosklet.

msqr1 avatar msqr1 commented on June 16, 2024

Yeah, because first time startup can be a tiny but slower due to compression, but it's just once. I'll do that later today.

from vosklet.

msqr1 avatar msqr1 commented on June 16, 2024

@jakespracher, I tried fixing it, by removing manual decompression, can you try it again?

from vosklet.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.