googlecreativelab / teachablemachine-community

Example code snippets and machine learning code for Teachable Machine
https://g.co/teachablemachine
Apache License 2.0
1.5k stars 669 forks source link

[BUG]: Unsupported URL scheme in metadata? #312

Closed Aki-NITTC closed 1 year ago

Aki-NITTC commented 1 year ago

Describe the bug after setting up the simple index.html using exported model, pressing "Start" button does nothing and produces an error:

Uncaught (in promise) Error: Unsupported URL scheme in metadata URL: ./my_model/metadata.json. Supported schemes are: http://, https://, and (node.js-only) file://
    R https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js:17
    o https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js:17
    o https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js:17
    i https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js:17
    i https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js:17
    R https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js:17
    R https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js:17
    o https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js:17
    o https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js:17
    i https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js:17
    i https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js:17
    ensureMetadataLoaded https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js:17
    R https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js:17
    o https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js:17
    o https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js:17
    i https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js:17
    i https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js:17
    ensureModelLoaded https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js:17
    createModel https://extraordinary-biscotti-27e6be.netlify.app/:37
    init https://extraordinary-biscotti-27e6be.netlify.app/:43
    onclick https://extraordinary-biscotti-27e6be.netlify.app/:1

To Reproduce

  1. setup an audio model from teachable machine, i have 4 classes including background noise
  2. after the training is done, export the model and setup simple html file using the code provided by teachable machine as follow:
    
    <!DOCTYPE html>
    <html lang="en">
Document
Teachable Machine Audio Model


3. put exported files(3 in total) in ./my_model folder
4. running the index.html on local machine and netlify will both cause the same error

**Relevant Links**
the one I used to test it
https://extraordinary-biscotti-27e6be.netlify.app/

**Expected behavior**
Start button does something? I would like to have any solution/advice to solve this. thanks
Aki-NITTC commented 1 year ago

Problem solved, it was an error that the ./my_model/ was not indicated as path, and you have to provide full path for this project type. See also https://github.com/googlecreativelab/teachablemachine-community/issues/60

by using upload not download on teachable machine webpage when exporting, you can save your models on the cloud and use that link instead(as a path for URL).