stackblitz / core

Online IDE powered by Visual Studio Code ⚡️
https://stackblitz.com
MIT License
10.18k stars 886 forks source link

TensorflowJS Load Model inside stackblitz ? #711

Open nukadelic opened 5 years ago

nukadelic commented 5 years ago

Since static assets are not yet supported over here, I have converted my weights file ( "group1-shard1of1", no file extension ) to base64 and saved it into a json file. From there it was possible to load the file via import as a string. Don't know much about binary arrays, but i did try base64-js lib, the fetch function and converting the data to blobs. Nothing seems to work for so far...

Is there a way to convert base64 into browser uploaded file objects ? Or any other solution ?

I'd really love to run my experiments in your editor, please consider adding support for / files as well, the one i'm trying to load is only 1/Mb in size.

Reference:


Edit: See working solution on codesandbox

kc0tlh commented 10 months ago

It looks like it's almost working in this demo app, but not quite there: https://stackblitz.com/edit/tensorflowjs-demo