microbit-foundation / pxt-ml-runner-poc

MIT License
0 stars 0 forks source link

Adding the extension to a MakeCode project fails #2

Closed microbit-carlos closed 1 month ago

microbit-carlos commented 1 month ago

Trying to add this extension to a project in the online MakeCode editor doesn't show the extension:

image

Looking at the dev tools console we can see the following errors:

image
pxtapp.js:1 
 GET https://pxt.azureedge.net/api/gh/microbit-foundation/pxt-ml-runner-poc?cdn=20240517 404 (Not Found)
pxtapp.js:1 Error: Bad HTTP status code: 404 at https://pxt.azureedge.net/api/gh/microbit-foundation/pxt-ml-runner-poc?cdn=20240517; message: {"message":"maximum file size in package is ~128k; file model-example/model_example.c; size 175979"}
    at pxtapp.js:1:66758
    at async E (pxtapp.js:1:209588)
    at async Promise.all (index 0)

The specific error message being:

maximum file size in package is ~128k; file model-example/model_example.c; size 175979

While the extension is quite large, as the embedded ML model is ~56KBs, I wouldn't have expected it to be larger than 128KBs, or around 175KBs as indicated by the error.

Building locally without BLE results in a binary that is ~200 KBs in total (not just the extension), so maybe MakeCode is confusing that full size?

microbit-carlos commented 1 month ago

Workaround

Rather than loading the extension via the GH URL, you can build the extension locally and drop the hex file into the editor.

microbit-carlos commented 1 month ago

This can be close as resolved as the built-in model has been changed to a smaller one.