From 8a18de737205f5b67049d30d2300a5645c429850 Mon Sep 17 00:00:00 2001 From: joeyklee Date: Thu, 3 Mar 2022 22:23:21 -0500 Subject: [PATCH] refactor: pickup utils in tests and adds callCallback tests --- examples/examples.json | 2 +- karma.conf.js | 2 + package-lock.json | 2 +- package.json | 2 +- src/utils/callcallback_test.js | 80 ++++++++++++++++++++++++++++++++++ 5 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 src/utils/callcallback_test.js diff --git a/examples/examples.json b/examples/examples.json index 07b378569..12ead0dc5 100644 --- a/examples/examples.json +++ b/examples/examples.json @@ -1 +1 @@ -{"BodyPix":{"p5js":[{"name":"BodyPix_Image","url":"../p5js/BodyPix/BodyPix_Image"},{"name":"BodyPix_Webcam","url":"../p5js/BodyPix/BodyPix_Webcam"},{"name":"BodyPix_Webcam_Parts","url":"../p5js/BodyPix/BodyPix_Webcam_Parts"}],"p5webeditor":[{"name":"BodyPix_Image","url":"https://editor.p5js.org/ml5/sketches/BodyPix_Image"},{"name":"BodyPix_Webcam","url":"https://editor.p5js.org/ml5/sketches/BodyPix_Webcam"},{"name":"BodyPix_Webcam_Parts","url":"https://editor.p5js.org/ml5/sketches/BodyPix_Webcam_Parts"}],"javascript":[{"name":"BodyPix_Image","url":"../javascript/BodyPix/BodyPix_Image"},{"name":"BodyPix_Webcam","url":"../javascript/BodyPix/BodyPix_Webcam"},{"name":"BodyPix_Webcam_Parts","url":"../javascript/BodyPix/BodyPix_Webcam_Parts"}]},"CVAE":{"p5js":[{"name":"CVAE_QuickDraw","url":"../p5js/CVAE/CVAE_QuickDraw"}],"p5webeditor":[{"name":"CVAE_QuickDraw","url":"https://editor.p5js.org/ml5/sketches/CVAE_QuickDraw"}],"javascript":[{"name":"CVAE_QuickDraw","url":"../javascript/CVAE/CVAE_QuickDraw"}]},"CartoonGAN":{"p5js":[{"name":"CartoonGan_Basic","url":"../p5js/CartoonGAN/CartoonGan_Basic"},{"name":"CartoonGan_LoadModel","url":"../p5js/CartoonGAN/CartoonGan_LoadModel"},{"name":"CartoonGan_WebCam","url":"../p5js/CartoonGAN/CartoonGan_WebCam"}],"p5webeditor":[{"name":"CartoonGan_Basic","url":"https://editor.p5js.org/ml5/sketches/CartoonGan_Basic"},{"name":"CartoonGan_LoadModel","url":"https://editor.p5js.org/ml5/sketches/CartoonGan_LoadModel"},{"name":"CartoonGan_WebCam","url":"https://editor.p5js.org/ml5/sketches/CartoonGan_WebCam"}]},"CharRNN":{"p5js":[{"name":"CharRNN_Interactive","url":"../p5js/CharRNN/CharRNN_Interactive"},{"name":"CharRNN_Text","url":"../p5js/CharRNN/CharRNN_Text"},{"name":"CharRNN_Text_Stateful","url":"../p5js/CharRNN/CharRNN_Text_Stateful"}],"p5webeditor":[{"name":"CharRNN_Interactive","url":"https://editor.p5js.org/ml5/sketches/CharRNN_Interactive"},{"name":"CharRNN_Text","url":"https://editor.p5js.org/ml5/sketches/CharRNN_Text"},{"name":"CharRNN_Text_Stateful","url":"https://editor.p5js.org/ml5/sketches/CharRNN_Text_Stateful"}],"javascript":[{"name":"CharRNN_Interactive","url":"../javascript/CharRNN/CharRNN_Interactive"},{"name":"CharRNN_Text","url":"../javascript/CharRNN/CharRNN_Text"},{"name":"CharRNN_Text_Stateful","url":"../javascript/CharRNN/CharRNN_Text_Stateful"}]},"DBSCAN":{"p5js":[],"p5webeditor":[],"d3":[{"name":"DBSCAN_Cluster","url":"../d3/DBSCAN/DBSCAN_Cluster"}]},"DCGAN":{"p5js":[{"name":"DCGAN_LatentVector_RandomWalk","url":"../p5js/DCGAN/DCGAN_LatentVector_RandomWalk"},{"name":"DCGAN_LatentVector_Slider","url":"../p5js/DCGAN/DCGAN_LatentVector_Slider"},{"name":"DCGAN_Random","url":"../p5js/DCGAN/DCGAN_Random"}],"p5webeditor":[{"name":"DCGAN_LatentVector_RandomWalk","url":"https://editor.p5js.org/ml5/sketches/DCGAN_LatentVector_RandomWalk"},{"name":"DCGAN_LatentVector_Slider","url":"https://editor.p5js.org/ml5/sketches/DCGAN_LatentVector_Slider"},{"name":"DCGAN_Random","url":"https://editor.p5js.org/ml5/sketches/DCGAN_Random"}],"javascript":[{"name":"DCGAN_Random","url":"../javascript/DCGAN/DCGAN_Random"}]},"FaceApi":{"p5js":[{"name":"FaceApi_Image_Landmarks","url":"../p5js/FaceApi/FaceApi_Image_Landmarks"},{"name":"FaceApi_Video_Landmarks","url":"../p5js/FaceApi/FaceApi_Video_Landmarks"},{"name":"FaceApi_Video_Landmarks_LocalModels","url":"../p5js/FaceApi/FaceApi_Video_Landmarks_LocalModels"}],"p5webeditor":[{"name":"FaceApi_Image_Landmarks","url":"https://editor.p5js.org/ml5/sketches/FaceApi_Image_Landmarks"},{"name":"FaceApi_Video_Landmarks","url":"https://editor.p5js.org/ml5/sketches/FaceApi_Video_Landmarks"},{"name":"FaceApi_Video_Landmarks_LocalModels","url":"https://editor.p5js.org/ml5/sketches/FaceApi_Video_Landmarks_LocalModels"}],"javascript":[{"name":"FaceApi_Image_Landmarks","url":"../javascript/FaceApi/FaceApi_Image_Landmarks"},{"name":"FaceApi_Video_Landmarks","url":"../javascript/FaceApi/FaceApi_Video_Landmarks"},{"name":"FaceApi_Video_Landmarks_LocalModels","url":"../javascript/FaceApi/FaceApi_Video_Landmarks_LocalModels"}]},"Facemesh":{"p5js":[{"name":"Facemesh_Image","url":"../p5js/Facemesh/Facemesh_Image"},{"name":"Facemesh_Webcam","url":"../p5js/Facemesh/Facemesh_Webcam"}],"p5webeditor":[{"name":"Facemesh_Image","url":"https://editor.p5js.org/ml5/sketches/Facemesh_Image"},{"name":"Facemesh_Webcam","url":"https://editor.p5js.org/ml5/sketches/Facemesh_Webcam"}]},"FeatureExtractor":{"p5js":[{"name":"FeatureExtractor_Image_Classification","url":"../p5js/FeatureExtractor/FeatureExtractor_Image_Classification"},{"name":"FeatureExtractor_Image_Regression","url":"../p5js/FeatureExtractor/FeatureExtractor_Image_Regression"}],"p5webeditor":[{"name":"FeatureExtractor_Image_Classification","url":"https://editor.p5js.org/ml5/sketches/FeatureExtractor_Image_Classification"},{"name":"FeatureExtractor_Image_Regression","url":"https://editor.p5js.org/ml5/sketches/FeatureExtractor_Image_Regression"}],"javascript":[{"name":"FeatureExtractor_Image_Classification","url":"../javascript/FeatureExtractor/FeatureExtractor_Image_Classification"},{"name":"FeatureExtractor_Image_Regression","url":"../javascript/FeatureExtractor/FeatureExtractor_Image_Regression"}]},"Handpose":{"p5js":[{"name":"Handpose_Image","url":"../p5js/Handpose/Handpose_Image"},{"name":"Handpose_Part_Selection","url":"../p5js/Handpose/Handpose_Part_Selection"},{"name":"Handpose_Webcam","url":"../p5js/Handpose/Handpose_Webcam"}],"p5webeditor":[{"name":"Handpose_Image","url":"https://editor.p5js.org/ml5/sketches/Handpose_Image"},{"name":"Handpose_Part_Selection","url":"https://editor.p5js.org/ml5/sketches/Handpose_Part_Selection"},{"name":"Handpose_Webcam","url":"https://editor.p5js.org/ml5/sketches/Handpose_Webcam"}]},"ImageClassification":{"p5js":[{"name":"ImageClassification","url":"../p5js/ImageClassification/ImageClassification"},{"name":"ImageClassification_DoodleNet_Canvas","url":"../p5js/ImageClassification/ImageClassification_DoodleNet_Canvas"},{"name":"ImageClassification_DoodleNet_Video","url":"../p5js/ImageClassification/ImageClassification_DoodleNet_Video"},{"name":"ImageClassification_MultipleImages","url":"../p5js/ImageClassification/ImageClassification_MultipleImages"},{"name":"ImageClassification_Video","url":"../p5js/ImageClassification/ImageClassification_Video"},{"name":"ImageClassification_VideoScavengerHunt","url":"../p5js/ImageClassification/ImageClassification_VideoScavengerHunt"},{"name":"ImageClassification_VideoSound","url":"../p5js/ImageClassification/ImageClassification_VideoSound"},{"name":"ImageClassification_VideoSoundTranslate","url":"../p5js/ImageClassification/ImageClassification_VideoSoundTranslate"},{"name":"ImageClassification_Video_Load","url":"../p5js/ImageClassification/ImageClassification_Video_Load"}],"p5webeditor":[{"name":"ImageClassification","url":"https://editor.p5js.org/ml5/sketches/ImageClassification"},{"name":"ImageClassification_DoodleNet_Canvas","url":"https://editor.p5js.org/ml5/sketches/ImageClassification_DoodleNet_Canvas"},{"name":"ImageClassification_DoodleNet_Video","url":"https://editor.p5js.org/ml5/sketches/ImageClassification_DoodleNet_Video"},{"name":"ImageClassification_MultipleImages","url":"https://editor.p5js.org/ml5/sketches/ImageClassification_MultipleImages"},{"name":"ImageClassification_Video","url":"https://editor.p5js.org/ml5/sketches/ImageClassification_Video"},{"name":"ImageClassification_VideoScavengerHunt","url":"https://editor.p5js.org/ml5/sketches/ImageClassification_VideoScavengerHunt"},{"name":"ImageClassification_VideoSound","url":"https://editor.p5js.org/ml5/sketches/ImageClassification_VideoSound"},{"name":"ImageClassification_VideoSoundTranslate","url":"https://editor.p5js.org/ml5/sketches/ImageClassification_VideoSoundTranslate"},{"name":"ImageClassification_Video_Load","url":"https://editor.p5js.org/ml5/sketches/ImageClassification_Video_Load"}],"javascript":[{"name":"ImageClassification","url":"../javascript/ImageClassification/ImageClassification"},{"name":"ImageClassification_DoodleNet_Canvas","url":"../javascript/ImageClassification/ImageClassification_DoodleNet_Canvas"},{"name":"ImageClassification_DoodleNet_Video","url":"../javascript/ImageClassification/ImageClassification_DoodleNet_Video"},{"name":"ImageClassification_MultipleImages","url":"../javascript/ImageClassification/ImageClassification_MultipleImages"},{"name":"ImageClassification_Video","url":"../javascript/ImageClassification/ImageClassification_Video"},{"name":"ImageClassification_VideoScavengerHunt","url":"../javascript/ImageClassification/ImageClassification_VideoScavengerHunt"},{"name":"ImageClassification_VideoSound","url":"../javascript/ImageClassification/ImageClassification_VideoSound"},{"name":"ImageClassification_Video_Load","url":"../javascript/ImageClassification/ImageClassification_Video_Load"}]},"KMeans":{"p5js":[{"name":"KMeans_imageSegmentation","url":"../p5js/KMeans/KMeans_imageSegmentation"},{"name":"KMeans_mouseClustering","url":"../p5js/KMeans/KMeans_mouseClustering"}],"p5webeditor":[{"name":"KMeans_imageSegmentation","url":"https://editor.p5js.org/ml5/sketches/KMeans_imageSegmentation"},{"name":"KMeans_mouseClustering","url":"https://editor.p5js.org/ml5/sketches/KMeans_mouseClustering"}],"d3":[{"name":"KMeans_GaussianClusterDemo","url":"../d3/KMeans/KMeans_GaussianClusterDemo"}]},"KNNClassification":{"p5js":[{"name":"KNNClassification_PoseNet","url":"../p5js/KNNClassification/KNNClassification_PoseNet"},{"name":"KNNClassification_Video","url":"../p5js/KNNClassification/KNNClassification_Video"},{"name":"KNNClassification_VideoSound","url":"../p5js/KNNClassification/KNNClassification_VideoSound"},{"name":"KNNClassification_VideoSquare","url":"../p5js/KNNClassification/KNNClassification_VideoSquare"}],"p5webeditor":[{"name":"KNNClassification_PoseNet","url":"https://editor.p5js.org/ml5/sketches/KNNClassification_PoseNet"},{"name":"KNNClassification_Video","url":"https://editor.p5js.org/ml5/sketches/KNNClassification_Video"},{"name":"KNNClassification_VideoSound","url":"https://editor.p5js.org/ml5/sketches/KNNClassification_VideoSound"},{"name":"KNNClassification_VideoSquare","url":"https://editor.p5js.org/ml5/sketches/KNNClassification_VideoSquare"}],"javascript":[{"name":"KNNClassification_PoseNet","url":"../javascript/KNNClassification/KNNClassification_PoseNet"},{"name":"KNNClassification_Video","url":"../javascript/KNNClassification/KNNClassification_Video"},{"name":"KNNClassification_VideoSound","url":"../javascript/KNNClassification/KNNClassification_VideoSound"},{"name":"KNNClassification_VideoSquare","url":"../javascript/KNNClassification/KNNClassification_VideoSquare"}]},"NeuralNetwork":{"p5js":[{"name":"NeuralNetwork_ImageClassifier_Colors","url":"../p5js/NeuralNetwork/NeuralNetwork_ImageClassifier_Colors"},{"name":"NeuralNetwork_ImageClassifier_Letters","url":"../p5js/NeuralNetwork/NeuralNetwork_ImageClassifier_Letters"},{"name":"NeuralNetwork_ImageClassifier_Video","url":"../p5js/NeuralNetwork/NeuralNetwork_ImageClassifier_Video"},{"name":"NeuralNetwork_Interactive_Regression","url":"../p5js/NeuralNetwork/NeuralNetwork_Interactive_Regression"},{"name":"NeuralNetwork_Simple_AorB","url":"../p5js/NeuralNetwork/NeuralNetwork_Simple_AorB"},{"name":"NeuralNetwork_Simple_Classification","url":"../p5js/NeuralNetwork/NeuralNetwork_Simple_Classification"},{"name":"NeuralNetwork_Simple_Regression","url":"../p5js/NeuralNetwork/NeuralNetwork_Simple_Regression"},{"name":"NeuralNetwork_XOR","url":"../p5js/NeuralNetwork/NeuralNetwork_XOR"},{"name":"NeuralNetwork_basics","url":"../p5js/NeuralNetwork/NeuralNetwork_basics"},{"name":"NeuralNetwork_co2net","url":"../p5js/NeuralNetwork/NeuralNetwork_co2net"},{"name":"NeuralNetwork_color_classifier","url":"../p5js/NeuralNetwork/NeuralNetwork_color_classifier"},{"name":"NeuralNetwork_load_model","url":"../p5js/NeuralNetwork/NeuralNetwork_load_model"},{"name":"NeuralNetwork_load_saved_data","url":"../p5js/NeuralNetwork/NeuralNetwork_load_saved_data"},{"name":"NeuralNetwork_lowres_pixels","url":"../p5js/NeuralNetwork/NeuralNetwork_lowres_pixels"},{"name":"NeuralNetwork_multiple_layers","url":"../p5js/NeuralNetwork/NeuralNetwork_multiple_layers"},{"name":"NeuralNetwork_musical_face","url":"../p5js/NeuralNetwork/NeuralNetwork_musical_face"},{"name":"NeuralNetwork_musical_mouse","url":"../p5js/NeuralNetwork/NeuralNetwork_musical_mouse"},{"name":"NeuralNetwork_pose_classifier","url":"../p5js/NeuralNetwork/NeuralNetwork_pose_classifier"},{"name":"NeuralNetwork_titanic","url":"../p5js/NeuralNetwork/NeuralNetwork_titanic"},{"name":"NeuralNetwork_xy_classifier","url":"../p5js/NeuralNetwork/NeuralNetwork_xy_classifier"},{"name":"NeuroEvolution_FlappyBird","url":"../p5js/NeuralNetwork/NeuroEvolution_FlappyBird"},{"name":"NeuroEvolution_Path","url":"../p5js/NeuralNetwork/NeuroEvolution_Path"},{"name":"NeuroEvolution_testing","url":"../p5js/NeuralNetwork/NeuroEvolution_testing"}],"p5webeditor":[{"name":"NeuralNetwork_ImageClassifier_Colors","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_ImageClassifier_Colors"},{"name":"NeuralNetwork_ImageClassifier_Letters","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_ImageClassifier_Letters"},{"name":"NeuralNetwork_ImageClassifier_Video","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_ImageClassifier_Video"},{"name":"NeuralNetwork_Interactive_Regression","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_Interactive_Regression"},{"name":"NeuralNetwork_Simple_AorB","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_Simple_AorB"},{"name":"NeuralNetwork_Simple_Classification","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_Simple_Classification"},{"name":"NeuralNetwork_Simple_Regression","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_Simple_Regression"},{"name":"NeuralNetwork_XOR","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_XOR"},{"name":"NeuralNetwork_basics","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_basics"},{"name":"NeuralNetwork_co2net","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_co2net"},{"name":"NeuralNetwork_color_classifier","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_color_classifier"},{"name":"NeuralNetwork_load_model","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_load_model"},{"name":"NeuralNetwork_load_saved_data","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_load_saved_data"},{"name":"NeuralNetwork_lowres_pixels","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_lowres_pixels"},{"name":"NeuralNetwork_multiple_layers","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_multiple_layers"},{"name":"NeuralNetwork_musical_face","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_musical_face"},{"name":"NeuralNetwork_musical_mouse","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_musical_mouse"},{"name":"NeuralNetwork_pose_classifier","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_pose_classifier"},{"name":"NeuralNetwork_titanic","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_titanic"},{"name":"NeuralNetwork_xy_classifier","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_xy_classifier"},{"name":"NeuroEvolution_FlappyBird","url":"https://editor.p5js.org/ml5/sketches/NeuroEvolution_FlappyBird"},{"name":"NeuroEvolution_Path","url":"https://editor.p5js.org/ml5/sketches/NeuroEvolution_Path"},{"name":"NeuroEvolution_testing","url":"https://editor.p5js.org/ml5/sketches/NeuroEvolution_testing"}]},"ObjectDetector":{"p5js":[{"name":"ObjectDetector_COCOSSD_Video","url":"../p5js/ObjectDetector/ObjectDetector_COCOSSD_Video"},{"name":"ObjectDetector_COCOSSD_single_image","url":"../p5js/ObjectDetector/ObjectDetector_COCOSSD_single_image"}],"p5webeditor":[{"name":"ObjectDetector_COCOSSD_Video","url":"https://editor.p5js.org/ml5/sketches/ObjectDetector_COCOSSD_Video"},{"name":"ObjectDetector_COCOSSD_single_image","url":"https://editor.p5js.org/ml5/sketches/ObjectDetector_COCOSSD_single_image"}],"javascript":[{"name":"COCOSSD_single_image","url":"../javascript/ObjectDetector/COCOSSD_single_image"},{"name":"COCOSSD_webcam","url":"../javascript/ObjectDetector/COCOSSD_webcam"},{"name":"YOLO_single_image","url":"../javascript/ObjectDetector/YOLO_single_image"},{"name":"YOLO_webcam","url":"../javascript/ObjectDetector/YOLO_webcam"}]},"PitchDetection":{"p5js":[{"name":"PitchDetection","url":"../p5js/PitchDetection/PitchDetection"},{"name":"PitchDetection_Game","url":"../p5js/PitchDetection/PitchDetection_Game"},{"name":"PitchDetection_Piano","url":"../p5js/PitchDetection/PitchDetection_Piano"}],"p5webeditor":[{"name":"PitchDetection","url":"https://editor.p5js.org/ml5/sketches/PitchDetection"},{"name":"PitchDetection_Game","url":"https://editor.p5js.org/ml5/sketches/PitchDetection_Game"},{"name":"PitchDetection_Piano","url":"https://editor.p5js.org/ml5/sketches/PitchDetection_Piano"}],"javascript":[{"name":"PitchDetection","url":"../javascript/PitchDetection/PitchDetection"},{"name":"PitchDetection_Game","url":"../javascript/PitchDetection/PitchDetection_Game"},{"name":"PitchDetection_Piano","url":"../javascript/PitchDetection/PitchDetection_Piano"}]},"Pix2Pix":{"p5js":[{"name":"Pix2Pix_callback","url":"../p5js/Pix2Pix/Pix2Pix_callback"},{"name":"Pix2Pix_promise","url":"../p5js/Pix2Pix/Pix2Pix_promise"}],"p5webeditor":[{"name":"Pix2Pix_callback","url":"https://editor.p5js.org/ml5/sketches/Pix2Pix_callback"},{"name":"Pix2Pix_promise","url":"https://editor.p5js.org/ml5/sketches/Pix2Pix_promise"}],"javascript":[{"name":"Pix2Pix_callback","url":"../javascript/Pix2Pix/Pix2Pix_callback"},{"name":"Pix2Pix_promise","url":"../javascript/Pix2Pix/Pix2Pix_promise"}]},"PoseNet":{"p5js":[{"name":"PoseNet_image_single","url":"../p5js/PoseNet/PoseNet_image_single"},{"name":"PoseNet_part_selection","url":"../p5js/PoseNet/PoseNet_part_selection"},{"name":"PoseNet_webcam","url":"../p5js/PoseNet/PoseNet_webcam"}],"p5webeditor":[{"name":"PoseNet_image_single","url":"https://editor.p5js.org/ml5/sketches/PoseNet_image_single"},{"name":"PoseNet_part_selection","url":"https://editor.p5js.org/ml5/sketches/PoseNet_part_selection"},{"name":"PoseNet_webcam","url":"https://editor.p5js.org/ml5/sketches/PoseNet_webcam"}],"javascript":[{"name":"PoseNet_image_single","url":"../javascript/PoseNet/PoseNet_image_single"},{"name":"PoseNet_part_selection","url":"../javascript/PoseNet/PoseNet_part_selection"},{"name":"PoseNet_webcam","url":"../javascript/PoseNet/PoseNet_webcam"}]},"Sentiment":{"p5js":[{"name":"Sentiment_Interactive","url":"../p5js/Sentiment/Sentiment_Interactive"}],"p5webeditor":[{"name":"Sentiment_Interactive","url":"https://editor.p5js.org/ml5/sketches/Sentiment_Interactive"}],"javascript":[{"name":"Sentiment_Interactive","url":"../javascript/Sentiment/Sentiment_Interactive"}]},"SketchRNN":{"p5js":[{"name":"SketchRNN_basic","url":"../p5js/SketchRNN/SketchRNN_basic"},{"name":"SketchRNN_interactive","url":"../p5js/SketchRNN/SketchRNN_interactive"}],"p5webeditor":[{"name":"SketchRNN_basic","url":"https://editor.p5js.org/ml5/sketches/SketchRNN_basic"},{"name":"SketchRNN_interactive","url":"https://editor.p5js.org/ml5/sketches/SketchRNN_interactive"}],"javascript":[{"name":"SketchRNN_basic","url":"../javascript/SketchRNN/SketchRNN_basic"},{"name":"SketchRNN_interactive","url":"../javascript/SketchRNN/SketchRNN_interactive"}]},"SoundClassification":{"p5js":[{"name":"SoundClassification_speechcommand","url":"../p5js/SoundClassification/SoundClassification_speechcommand"},{"name":"SoundClassification_speechcommand_load","url":"../p5js/SoundClassification/SoundClassification_speechcommand_load"}],"p5webeditor":[{"name":"SoundClassification_speechcommand","url":"https://editor.p5js.org/ml5/sketches/SoundClassification_speechcommand"},{"name":"SoundClassification_speechcommand_load","url":"https://editor.p5js.org/ml5/sketches/SoundClassification_speechcommand_load"}],"javascript":[{"name":"SoundClassification_speechcommand","url":"../javascript/SoundClassification/SoundClassification_speechcommand"},{"name":"SoundClassification_speechcommand_load","url":"../javascript/SoundClassification/SoundClassification_speechcommand_load"}]},"StyleTransfer":{"p5js":[{"name":"StyleTransfer_Image","url":"../p5js/StyleTransfer/StyleTransfer_Image"},{"name":"StyleTransfer_Video","url":"../p5js/StyleTransfer/StyleTransfer_Video"}],"p5webeditor":[{"name":"StyleTransfer_Image","url":"https://editor.p5js.org/ml5/sketches/StyleTransfer_Image"},{"name":"StyleTransfer_Video","url":"https://editor.p5js.org/ml5/sketches/StyleTransfer_Video"}],"javascript":[{"name":"StyleTransfer_Image","url":"../javascript/StyleTransfer/StyleTransfer_Image"},{"name":"StyleTransfer_Video","url":"../javascript/StyleTransfer/StyleTransfer_Video"}]},"TeachableMachine":{"p5js":[{"name":"ImageModel_TM","url":"../p5js/TeachableMachine/ImageModel_TM"},{"name":"SoundModel_TM","url":"../p5js/TeachableMachine/SoundModel_TM"}],"p5webeditor":[{"name":"ImageModel_TM","url":"https://editor.p5js.org/ml5/sketches/ImageModel_TM"},{"name":"SoundModel_TM","url":"https://editor.p5js.org/ml5/sketches/SoundModel_TM"}]},"UNET":{"p5js":[{"name":"UNET_webcam","url":"../p5js/UNET/UNET_webcam"}],"p5webeditor":[{"name":"UNET_webcam","url":"https://editor.p5js.org/ml5/sketches/UNET_webcam"}],"javascript":[{"name":"UNET_webcam","url":"../javascript/UNET/UNET_webcam"}]},"UniversalSentenceEncoder":{"p5js":[{"name":"UniversalSentenceEncoder_Basic","url":"../p5js/UniversalSentenceEncoder/UniversalSentenceEncoder_Basic"},{"name":"UniversalSentenceEncoder_WithTokenizer","url":"../p5js/UniversalSentenceEncoder/UniversalSentenceEncoder_WithTokenizer"}],"p5webeditor":[{"name":"UniversalSentenceEncoder_Basic","url":"https://editor.p5js.org/ml5/sketches/UniversalSentenceEncoder_Basic"},{"name":"UniversalSentenceEncoder_WithTokenizer","url":"https://editor.p5js.org/ml5/sketches/UniversalSentenceEncoder_WithTokenizer"}]},"YOLO":{"p5js":[{"name":"YOLO_single_image","url":"../p5js/YOLO/YOLO_single_image"},{"name":"YOLO_webcam","url":"../p5js/YOLO/YOLO_webcam"}],"p5webeditor":[{"name":"YOLO_single_image","url":"https://editor.p5js.org/ml5/sketches/YOLO_single_image"},{"name":"YOLO_webcam","url":"https://editor.p5js.org/ml5/sketches/YOLO_webcam"}],"javascript":[{"name":"YOLO_single_image","url":"../javascript/YOLO/YOLO_single_image"},{"name":"YOLO_webcam","url":"../javascript/YOLO/YOLO_webcam"}]},"ml5Boilerplate":{"p5js":[{"name":"ml5Boilerplate_Version","url":"../p5js/ml5Boilerplate/ml5Boilerplate_Version"}],"p5webeditor":[{"name":"ml5Boilerplate_Version","url":"https://editor.p5js.org/ml5/sketches/ml5Boilerplate_Version"}],"javascript":[{"name":"ml5Boilerplate_Version","url":"../javascript/ml5Boilerplate/ml5Boilerplate_Version"}]}} +{"BodyPix":{"p5js":[{"name":"BodyPix_Image","url":"../p5js/BodyPix/BodyPix_Image"},{"name":"BodyPix_Webcam","url":"../p5js/BodyPix/BodyPix_Webcam"},{"name":"BodyPix_Webcam_Parts","url":"../p5js/BodyPix/BodyPix_Webcam_Parts"}],"p5webeditor":[{"name":"BodyPix_Image","url":"https://editor.p5js.org/ml5/sketches/BodyPix_Image"},{"name":"BodyPix_Webcam","url":"https://editor.p5js.org/ml5/sketches/BodyPix_Webcam"},{"name":"BodyPix_Webcam_Parts","url":"https://editor.p5js.org/ml5/sketches/BodyPix_Webcam_Parts"}],"javascript":[{"name":"BodyPix_Image","url":"../javascript/BodyPix/BodyPix_Image"},{"name":"BodyPix_Webcam","url":"../javascript/BodyPix/BodyPix_Webcam"},{"name":"BodyPix_Webcam_Parts","url":"../javascript/BodyPix/BodyPix_Webcam_Parts"}]},"CVAE":{"p5js":[{"name":"CVAE_QuickDraw","url":"../p5js/CVAE/CVAE_QuickDraw"}],"p5webeditor":[{"name":"CVAE_QuickDraw","url":"https://editor.p5js.org/ml5/sketches/CVAE_QuickDraw"}],"javascript":[{"name":"CVAE_QuickDraw","url":"../javascript/CVAE/CVAE_QuickDraw"}]},"CartoonGAN":{"p5js":[{"name":"CartoonGan_Basic","url":"../p5js/CartoonGAN/CartoonGan_Basic"},{"name":"CartoonGan_LoadModel","url":"../p5js/CartoonGAN/CartoonGan_LoadModel"},{"name":"CartoonGan_WebCam","url":"../p5js/CartoonGAN/CartoonGan_WebCam"}],"p5webeditor":[{"name":"CartoonGan_Basic","url":"https://editor.p5js.org/ml5/sketches/CartoonGan_Basic"},{"name":"CartoonGan_LoadModel","url":"https://editor.p5js.org/ml5/sketches/CartoonGan_LoadModel"},{"name":"CartoonGan_WebCam","url":"https://editor.p5js.org/ml5/sketches/CartoonGan_WebCam"}]},"CharRNN":{"p5js":[{"name":"CharRNN_Interactive","url":"../p5js/CharRNN/CharRNN_Interactive"},{"name":"CharRNN_Text","url":"../p5js/CharRNN/CharRNN_Text"},{"name":"CharRNN_Text_Stateful","url":"../p5js/CharRNN/CharRNN_Text_Stateful"}],"p5webeditor":[{"name":"CharRNN_Interactive","url":"https://editor.p5js.org/ml5/sketches/CharRNN_Interactive"},{"name":"CharRNN_Text","url":"https://editor.p5js.org/ml5/sketches/CharRNN_Text"},{"name":"CharRNN_Text_Stateful","url":"https://editor.p5js.org/ml5/sketches/CharRNN_Text_Stateful"}],"javascript":[{"name":"CharRNN_Interactive","url":"../javascript/CharRNN/CharRNN_Interactive"},{"name":"CharRNN_Text","url":"../javascript/CharRNN/CharRNN_Text"},{"name":"CharRNN_Text_Stateful","url":"../javascript/CharRNN/CharRNN_Text_Stateful"}]},"DBSCAN":{"p5js":[],"p5webeditor":[],"d3":[{"name":"DBSCAN_Cluster","url":"../d3/DBSCAN/DBSCAN_Cluster"}]},"DCGAN":{"p5js":[{"name":"DCGAN_LatentVector_RandomWalk","url":"../p5js/DCGAN/DCGAN_LatentVector_RandomWalk"},{"name":"DCGAN_LatentVector_Slider","url":"../p5js/DCGAN/DCGAN_LatentVector_Slider"},{"name":"DCGAN_Random","url":"../p5js/DCGAN/DCGAN_Random"}],"p5webeditor":[{"name":"DCGAN_LatentVector_RandomWalk","url":"https://editor.p5js.org/ml5/sketches/DCGAN_LatentVector_RandomWalk"},{"name":"DCGAN_LatentVector_Slider","url":"https://editor.p5js.org/ml5/sketches/DCGAN_LatentVector_Slider"},{"name":"DCGAN_Random","url":"https://editor.p5js.org/ml5/sketches/DCGAN_Random"}],"javascript":[{"name":"DCGAN_Random","url":"../javascript/DCGAN/DCGAN_Random"}]},"FaceApi":{"p5js":[{"name":"FaceApi_Image_Landmarks","url":"../p5js/FaceApi/FaceApi_Image_Landmarks"},{"name":"FaceApi_Video_Landmarks","url":"../p5js/FaceApi/FaceApi_Video_Landmarks"},{"name":"FaceApi_Video_Landmarks_LocalModels","url":"../p5js/FaceApi/FaceApi_Video_Landmarks_LocalModels"}],"p5webeditor":[{"name":"FaceApi_Image_Landmarks","url":"https://editor.p5js.org/ml5/sketches/FaceApi_Image_Landmarks"},{"name":"FaceApi_Video_Landmarks","url":"https://editor.p5js.org/ml5/sketches/FaceApi_Video_Landmarks"},{"name":"FaceApi_Video_Landmarks_LocalModels","url":"https://editor.p5js.org/ml5/sketches/FaceApi_Video_Landmarks_LocalModels"}],"javascript":[{"name":"FaceApi_Image_Landmarks","url":"../javascript/FaceApi/FaceApi_Image_Landmarks"},{"name":"FaceApi_Video_Landmarks","url":"../javascript/FaceApi/FaceApi_Video_Landmarks"},{"name":"FaceApi_Video_Landmarks_LocalModels","url":"../javascript/FaceApi/FaceApi_Video_Landmarks_LocalModels"}]},"Facemesh":{"p5js":[{"name":"Facemesh_Image","url":"../p5js/Facemesh/Facemesh_Image"},{"name":"Facemesh_Webcam","url":"../p5js/Facemesh/Facemesh_Webcam"}],"p5webeditor":[{"name":"Facemesh_Image","url":"https://editor.p5js.org/ml5/sketches/Facemesh_Image"},{"name":"Facemesh_Webcam","url":"https://editor.p5js.org/ml5/sketches/Facemesh_Webcam"}]},"FeatureExtractor":{"p5js":[{"name":"FeatureExtractor_Image_Classification","url":"../p5js/FeatureExtractor/FeatureExtractor_Image_Classification"},{"name":"FeatureExtractor_Image_Regression","url":"../p5js/FeatureExtractor/FeatureExtractor_Image_Regression"}],"p5webeditor":[{"name":"FeatureExtractor_Image_Classification","url":"https://editor.p5js.org/ml5/sketches/FeatureExtractor_Image_Classification"},{"name":"FeatureExtractor_Image_Regression","url":"https://editor.p5js.org/ml5/sketches/FeatureExtractor_Image_Regression"}],"javascript":[{"name":"FeatureExtractor_Image_Classification","url":"../javascript/FeatureExtractor/FeatureExtractor_Image_Classification"},{"name":"FeatureExtractor_Image_Regression","url":"../javascript/FeatureExtractor/FeatureExtractor_Image_Regression"}]},"Handpose":{"p5js":[{"name":"Handpose_Image","url":"../p5js/Handpose/Handpose_Image"},{"name":"Handpose_Part_Selection","url":"../p5js/Handpose/Handpose_Part_Selection"},{"name":"Handpose_Webcam","url":"../p5js/Handpose/Handpose_Webcam"}],"p5webeditor":[{"name":"Handpose_Image","url":"https://editor.p5js.org/ml5/sketches/Handpose_Image"},{"name":"Handpose_Part_Selection","url":"https://editor.p5js.org/ml5/sketches/Handpose_Part_Selection"},{"name":"Handpose_Webcam","url":"https://editor.p5js.org/ml5/sketches/Handpose_Webcam"}]},"ImageClassification":{"p5js":[{"name":"ImageClassification","url":"../p5js/ImageClassification/ImageClassification"},{"name":"ImageClassification_DoodleNet_Canvas","url":"../p5js/ImageClassification/ImageClassification_DoodleNet_Canvas"},{"name":"ImageClassification_DoodleNet_Video","url":"../p5js/ImageClassification/ImageClassification_DoodleNet_Video"},{"name":"ImageClassification_MultipleImages","url":"../p5js/ImageClassification/ImageClassification_MultipleImages"},{"name":"ImageClassification_Video","url":"../p5js/ImageClassification/ImageClassification_Video"},{"name":"ImageClassification_VideoScavengerHunt","url":"../p5js/ImageClassification/ImageClassification_VideoScavengerHunt"},{"name":"ImageClassification_VideoSound","url":"../p5js/ImageClassification/ImageClassification_VideoSound"},{"name":"ImageClassification_VideoSoundTranslate","url":"../p5js/ImageClassification/ImageClassification_VideoSoundTranslate"},{"name":"ImageClassification_Video_Load","url":"../p5js/ImageClassification/ImageClassification_Video_Load"}],"p5webeditor":[{"name":"ImageClassification","url":"https://editor.p5js.org/ml5/sketches/ImageClassification"},{"name":"ImageClassification_DoodleNet_Canvas","url":"https://editor.p5js.org/ml5/sketches/ImageClassification_DoodleNet_Canvas"},{"name":"ImageClassification_DoodleNet_Video","url":"https://editor.p5js.org/ml5/sketches/ImageClassification_DoodleNet_Video"},{"name":"ImageClassification_MultipleImages","url":"https://editor.p5js.org/ml5/sketches/ImageClassification_MultipleImages"},{"name":"ImageClassification_Video","url":"https://editor.p5js.org/ml5/sketches/ImageClassification_Video"},{"name":"ImageClassification_VideoScavengerHunt","url":"https://editor.p5js.org/ml5/sketches/ImageClassification_VideoScavengerHunt"},{"name":"ImageClassification_VideoSound","url":"https://editor.p5js.org/ml5/sketches/ImageClassification_VideoSound"},{"name":"ImageClassification_VideoSoundTranslate","url":"https://editor.p5js.org/ml5/sketches/ImageClassification_VideoSoundTranslate"},{"name":"ImageClassification_Video_Load","url":"https://editor.p5js.org/ml5/sketches/ImageClassification_Video_Load"}],"javascript":[{"name":"ImageClassification","url":"../javascript/ImageClassification/ImageClassification"},{"name":"ImageClassification_DoodleNet_Canvas","url":"../javascript/ImageClassification/ImageClassification_DoodleNet_Canvas"},{"name":"ImageClassification_DoodleNet_Video","url":"../javascript/ImageClassification/ImageClassification_DoodleNet_Video"},{"name":"ImageClassification_MultipleImages","url":"../javascript/ImageClassification/ImageClassification_MultipleImages"},{"name":"ImageClassification_Video","url":"../javascript/ImageClassification/ImageClassification_Video"},{"name":"ImageClassification_VideoScavengerHunt","url":"../javascript/ImageClassification/ImageClassification_VideoScavengerHunt"},{"name":"ImageClassification_VideoSound","url":"../javascript/ImageClassification/ImageClassification_VideoSound"},{"name":"ImageClassification_Video_Load","url":"../javascript/ImageClassification/ImageClassification_Video_Load"}]},"KMeans":{"p5js":[{"name":"KMeans_imageSegmentation","url":"../p5js/KMeans/KMeans_imageSegmentation"},{"name":"KMeans_mouseClustering","url":"../p5js/KMeans/KMeans_mouseClustering"}],"p5webeditor":[{"name":"KMeans_imageSegmentation","url":"https://editor.p5js.org/ml5/sketches/KMeans_imageSegmentation"},{"name":"KMeans_mouseClustering","url":"https://editor.p5js.org/ml5/sketches/KMeans_mouseClustering"}],"d3":[{"name":"KMeans_GaussianClusterDemo","url":"../d3/KMeans/KMeans_GaussianClusterDemo"}]},"KNNClassification":{"p5js":[{"name":"KNNClassification_PoseNet","url":"../p5js/KNNClassification/KNNClassification_PoseNet"},{"name":"KNNClassification_Video","url":"../p5js/KNNClassification/KNNClassification_Video"},{"name":"KNNClassification_VideoSound","url":"../p5js/KNNClassification/KNNClassification_VideoSound"},{"name":"KNNClassification_VideoSquare","url":"../p5js/KNNClassification/KNNClassification_VideoSquare"}],"p5webeditor":[{"name":"KNNClassification_PoseNet","url":"https://editor.p5js.org/ml5/sketches/KNNClassification_PoseNet"},{"name":"KNNClassification_Video","url":"https://editor.p5js.org/ml5/sketches/KNNClassification_Video"},{"name":"KNNClassification_VideoSound","url":"https://editor.p5js.org/ml5/sketches/KNNClassification_VideoSound"},{"name":"KNNClassification_VideoSquare","url":"https://editor.p5js.org/ml5/sketches/KNNClassification_VideoSquare"}],"javascript":[{"name":"KNNClassification_PoseNet","url":"../javascript/KNNClassification/KNNClassification_PoseNet"},{"name":"KNNClassification_Video","url":"../javascript/KNNClassification/KNNClassification_Video"},{"name":"KNNClassification_VideoSound","url":"../javascript/KNNClassification/KNNClassification_VideoSound"},{"name":"KNNClassification_VideoSquare","url":"../javascript/KNNClassification/KNNClassification_VideoSquare"}]},"NeuralNetwork":{"p5js":[{"name":"NeuralNetwork_ImageClassifier_Colors","url":"../p5js/NeuralNetwork/NeuralNetwork_ImageClassifier_Colors"},{"name":"NeuralNetwork_ImageClassifier_Letters","url":"../p5js/NeuralNetwork/NeuralNetwork_ImageClassifier_Letters"},{"name":"NeuralNetwork_ImageClassifier_Video","url":"../p5js/NeuralNetwork/NeuralNetwork_ImageClassifier_Video"},{"name":"NeuralNetwork_Interactive_Regression","url":"../p5js/NeuralNetwork/NeuralNetwork_Interactive_Regression"},{"name":"NeuralNetwork_Simple_AorB","url":"../p5js/NeuralNetwork/NeuralNetwork_Simple_AorB"},{"name":"NeuralNetwork_Simple_Classification","url":"../p5js/NeuralNetwork/NeuralNetwork_Simple_Classification"},{"name":"NeuralNetwork_Simple_Regression","url":"../p5js/NeuralNetwork/NeuralNetwork_Simple_Regression"},{"name":"NeuralNetwork_XOR","url":"../p5js/NeuralNetwork/NeuralNetwork_XOR"},{"name":"NeuralNetwork_basics","url":"../p5js/NeuralNetwork/NeuralNetwork_basics"},{"name":"NeuralNetwork_co2net","url":"../p5js/NeuralNetwork/NeuralNetwork_co2net"},{"name":"NeuralNetwork_color_classifier","url":"../p5js/NeuralNetwork/NeuralNetwork_color_classifier"},{"name":"NeuralNetwork_load_model","url":"../p5js/NeuralNetwork/NeuralNetwork_load_model"},{"name":"NeuralNetwork_load_saved_data","url":"../p5js/NeuralNetwork/NeuralNetwork_load_saved_data"},{"name":"NeuralNetwork_lowres_pixels","url":"../p5js/NeuralNetwork/NeuralNetwork_lowres_pixels"},{"name":"NeuralNetwork_multiple_layers","url":"../p5js/NeuralNetwork/NeuralNetwork_multiple_layers"},{"name":"NeuralNetwork_musical_face","url":"../p5js/NeuralNetwork/NeuralNetwork_musical_face"},{"name":"NeuralNetwork_musical_mouse","url":"../p5js/NeuralNetwork/NeuralNetwork_musical_mouse"},{"name":"NeuralNetwork_pose_classifier","url":"../p5js/NeuralNetwork/NeuralNetwork_pose_classifier"},{"name":"NeuralNetwork_titanic","url":"../p5js/NeuralNetwork/NeuralNetwork_titanic"},{"name":"NeuralNetwork_xy_classifier","url":"../p5js/NeuralNetwork/NeuralNetwork_xy_classifier"},{"name":"NeuroEvolution_FlappyBird","url":"../p5js/NeuralNetwork/NeuroEvolution_FlappyBird"},{"name":"NeuroEvolution_Path","url":"../p5js/NeuralNetwork/NeuroEvolution_Path"},{"name":"NeuroEvolution_testing","url":"../p5js/NeuralNetwork/NeuroEvolution_testing"}],"p5webeditor":[{"name":"NeuralNetwork_ImageClassifier_Colors","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_ImageClassifier_Colors"},{"name":"NeuralNetwork_ImageClassifier_Letters","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_ImageClassifier_Letters"},{"name":"NeuralNetwork_ImageClassifier_Video","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_ImageClassifier_Video"},{"name":"NeuralNetwork_Interactive_Regression","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_Interactive_Regression"},{"name":"NeuralNetwork_Simple_AorB","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_Simple_AorB"},{"name":"NeuralNetwork_Simple_Classification","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_Simple_Classification"},{"name":"NeuralNetwork_Simple_Regression","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_Simple_Regression"},{"name":"NeuralNetwork_XOR","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_XOR"},{"name":"NeuralNetwork_basics","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_basics"},{"name":"NeuralNetwork_co2net","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_co2net"},{"name":"NeuralNetwork_color_classifier","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_color_classifier"},{"name":"NeuralNetwork_load_model","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_load_model"},{"name":"NeuralNetwork_load_saved_data","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_load_saved_data"},{"name":"NeuralNetwork_lowres_pixels","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_lowres_pixels"},{"name":"NeuralNetwork_multiple_layers","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_multiple_layers"},{"name":"NeuralNetwork_musical_face","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_musical_face"},{"name":"NeuralNetwork_musical_mouse","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_musical_mouse"},{"name":"NeuralNetwork_pose_classifier","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_pose_classifier"},{"name":"NeuralNetwork_titanic","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_titanic"},{"name":"NeuralNetwork_xy_classifier","url":"https://editor.p5js.org/ml5/sketches/NeuralNetwork_xy_classifier"},{"name":"NeuroEvolution_FlappyBird","url":"https://editor.p5js.org/ml5/sketches/NeuroEvolution_FlappyBird"},{"name":"NeuroEvolution_Path","url":"https://editor.p5js.org/ml5/sketches/NeuroEvolution_Path"},{"name":"NeuroEvolution_testing","url":"https://editor.p5js.org/ml5/sketches/NeuroEvolution_testing"}]},"ObjectDetector":{"p5js":[{"name":"ObjectDetector_COCOSSD_Video","url":"../p5js/ObjectDetector/ObjectDetector_COCOSSD_Video"},{"name":"ObjectDetector_COCOSSD_single_image","url":"../p5js/ObjectDetector/ObjectDetector_COCOSSD_single_image"}],"p5webeditor":[{"name":"ObjectDetector_COCOSSD_Video","url":"https://editor.p5js.org/ml5/sketches/ObjectDetector_COCOSSD_Video"},{"name":"ObjectDetector_COCOSSD_single_image","url":"https://editor.p5js.org/ml5/sketches/ObjectDetector_COCOSSD_single_image"}],"javascript":[{"name":"COCOSSD_single_image","url":"../javascript/ObjectDetector/COCOSSD_single_image"},{"name":"COCOSSD_webcam","url":"../javascript/ObjectDetector/COCOSSD_webcam"},{"name":"YOLO_single_image","url":"../javascript/ObjectDetector/YOLO_single_image"},{"name":"YOLO_webcam","url":"../javascript/ObjectDetector/YOLO_webcam"}]},"PitchDetection":{"p5js":[{"name":"PitchDetection","url":"../p5js/PitchDetection/PitchDetection"},{"name":"PitchDetection_Game","url":"../p5js/PitchDetection/PitchDetection_Game"},{"name":"PitchDetection_Piano","url":"../p5js/PitchDetection/PitchDetection_Piano"}],"p5webeditor":[{"name":"PitchDetection","url":"https://editor.p5js.org/ml5/sketches/PitchDetection"},{"name":"PitchDetection_Game","url":"https://editor.p5js.org/ml5/sketches/PitchDetection_Game"},{"name":"PitchDetection_Piano","url":"https://editor.p5js.org/ml5/sketches/PitchDetection_Piano"}],"javascript":[{"name":"PitchDetection","url":"../javascript/PitchDetection/PitchDetection"},{"name":"PitchDetection_Game","url":"../javascript/PitchDetection/PitchDetection_Game"},{"name":"PitchDetection_Piano","url":"../javascript/PitchDetection/PitchDetection_Piano"}]},"Pix2Pix":{"p5js":[{"name":"Pix2Pix_callback","url":"../p5js/Pix2Pix/Pix2Pix_callback"},{"name":"Pix2Pix_promise","url":"../p5js/Pix2Pix/Pix2Pix_promise"}],"p5webeditor":[{"name":"Pix2Pix_callback","url":"https://editor.p5js.org/ml5/sketches/Pix2Pix_callback"},{"name":"Pix2Pix_promise","url":"https://editor.p5js.org/ml5/sketches/Pix2Pix_promise"}],"javascript":[{"name":"Pix2Pix_callback","url":"../javascript/Pix2Pix/Pix2Pix_callback"},{"name":"Pix2Pix_promise","url":"../javascript/Pix2Pix/Pix2Pix_promise"}]},"PoseNet":{"p5js":[{"name":"PoseNet_image_single","url":"../p5js/PoseNet/PoseNet_image_single"},{"name":"PoseNet_part_selection","url":"../p5js/PoseNet/PoseNet_part_selection"},{"name":"PoseNet_webcam","url":"../p5js/PoseNet/PoseNet_webcam"}],"p5webeditor":[{"name":"PoseNet_image_single","url":"https://editor.p5js.org/ml5/sketches/PoseNet_image_single"},{"name":"PoseNet_part_selection","url":"https://editor.p5js.org/ml5/sketches/PoseNet_part_selection"},{"name":"PoseNet_webcam","url":"https://editor.p5js.org/ml5/sketches/PoseNet_webcam"}],"javascript":[{"name":"PoseNet_image_single","url":"../javascript/PoseNet/PoseNet_image_single"},{"name":"PoseNet_part_selection","url":"../javascript/PoseNet/PoseNet_part_selection"},{"name":"PoseNet_webcam","url":"../javascript/PoseNet/PoseNet_webcam"}]},"Sentiment":{"p5js":[{"name":"Sentiment_Interactive","url":"../p5js/Sentiment/Sentiment_Interactive"}],"p5webeditor":[{"name":"Sentiment_Interactive","url":"https://editor.p5js.org/ml5/sketches/Sentiment_Interactive"}],"javascript":[{"name":"Sentiment_Interactive","url":"../javascript/Sentiment/Sentiment_Interactive"}]},"SketchRNN":{"p5js":[{"name":"SketchRNN_basic","url":"../p5js/SketchRNN/SketchRNN_basic"},{"name":"SketchRNN_interactive","url":"../p5js/SketchRNN/SketchRNN_interactive"}],"p5webeditor":[{"name":"SketchRNN_basic","url":"https://editor.p5js.org/ml5/sketches/SketchRNN_basic"},{"name":"SketchRNN_interactive","url":"https://editor.p5js.org/ml5/sketches/SketchRNN_interactive"}],"javascript":[{"name":"SketchRNN_basic","url":"../javascript/SketchRNN/SketchRNN_basic"},{"name":"SketchRNN_interactive","url":"../javascript/SketchRNN/SketchRNN_interactive"}]},"SoundClassification":{"p5js":[{"name":"SoundClassification_speechcommand","url":"../p5js/SoundClassification/SoundClassification_speechcommand"},{"name":"SoundClassification_speechcommand_load","url":"../p5js/SoundClassification/SoundClassification_speechcommand_load"}],"p5webeditor":[{"name":"SoundClassification_speechcommand","url":"https://editor.p5js.org/ml5/sketches/SoundClassification_speechcommand"},{"name":"SoundClassification_speechcommand_load","url":"https://editor.p5js.org/ml5/sketches/SoundClassification_speechcommand_load"}],"javascript":[{"name":"SoundClassification_speechcommand","url":"../javascript/SoundClassification/SoundClassification_speechcommand"},{"name":"SoundClassification_speechcommand_load","url":"../javascript/SoundClassification/SoundClassification_speechcommand_load"}]},"StyleTransfer":{"p5js":[{"name":"StyleTransfer_Image","url":"../p5js/StyleTransfer/StyleTransfer_Image"},{"name":"StyleTransfer_Video","url":"../p5js/StyleTransfer/StyleTransfer_Video"}],"p5webeditor":[{"name":"StyleTransfer_Image","url":"https://editor.p5js.org/ml5/sketches/StyleTransfer_Image"},{"name":"StyleTransfer_Video","url":"https://editor.p5js.org/ml5/sketches/StyleTransfer_Video"}],"javascript":[{"name":"StyleTransfer_Image","url":"../javascript/StyleTransfer/StyleTransfer_Image"},{"name":"StyleTransfer_Video","url":"../javascript/StyleTransfer/StyleTransfer_Video"}]},"TeachableMachine":{"p5js":[{"name":"ImageModel_TM","url":"../p5js/TeachableMachine/ImageModel_TM"},{"name":"SoundModel_TM","url":"../p5js/TeachableMachine/SoundModel_TM"}],"p5webeditor":[{"name":"ImageModel_TM","url":"https://editor.p5js.org/ml5/sketches/ImageModel_TM"},{"name":"SoundModel_TM","url":"https://editor.p5js.org/ml5/sketches/SoundModel_TM"}]},"UNET":{"p5js":[{"name":"UNET_webcam","url":"../p5js/UNET/UNET_webcam"}],"p5webeditor":[{"name":"UNET_webcam","url":"https://editor.p5js.org/ml5/sketches/UNET_webcam"}],"javascript":[{"name":"UNET_webcam","url":"../javascript/UNET/UNET_webcam"}]},"UniversalSentenceEncoder":{"p5js":[{"name":"UniversalSentenceEncoder_Basic","url":"../p5js/UniversalSentenceEncoder/UniversalSentenceEncoder_Basic"},{"name":"UniversalSentenceEncoder_WithTokenizer","url":"../p5js/UniversalSentenceEncoder/UniversalSentenceEncoder_WithTokenizer"}],"p5webeditor":[{"name":"UniversalSentenceEncoder_Basic","url":"https://editor.p5js.org/ml5/sketches/UniversalSentenceEncoder_Basic"},{"name":"UniversalSentenceEncoder_WithTokenizer","url":"https://editor.p5js.org/ml5/sketches/UniversalSentenceEncoder_WithTokenizer"}]},"YOLO":{"p5js":[{"name":"YOLO_single_image","url":"../p5js/YOLO/YOLO_single_image"},{"name":"YOLO_webcam","url":"../p5js/YOLO/YOLO_webcam"}],"p5webeditor":[{"name":"YOLO_single_image","url":"https://editor.p5js.org/ml5/sketches/YOLO_single_image"},{"name":"YOLO_webcam","url":"https://editor.p5js.org/ml5/sketches/YOLO_webcam"}],"javascript":[{"name":"YOLO_single_image","url":"../javascript/YOLO/YOLO_single_image"},{"name":"YOLO_webcam","url":"../javascript/YOLO/YOLO_webcam"}]},"ml5Boilerplate":{"p5js":[{"name":"ml5Boilerplate_Version","url":"../p5js/ml5Boilerplate/ml5Boilerplate_Version"}],"p5webeditor":[{"name":"ml5Boilerplate_Version","url":"https://editor.p5js.org/ml5/sketches/ml5Boilerplate_Version"}],"javascript":[{"name":"ml5Boilerplate_Version","url":"../javascript/ml5Boilerplate/ml5Boilerplate_Version"}]}} \ No newline at end of file diff --git a/karma.conf.js b/karma.conf.js index 1d952d06d..9ca2f9f27 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -11,11 +11,13 @@ module.exports = config => { frameworks: ["jasmine"], files: [ "src/index.js", + "src/utils/*_test.js", `src/${config.model ? config.model : "**"}/*_test.js`, `src/${config.model ? config.model : "**"}/**/*_test.js`, ], preprocessors: { "src/index.js": ["webpack"], + "src/utils/*.js": ["webpack"], }, webpack: { // TODO: This is duplication of the webpack.common.babel.js file, but they diff --git a/package-lock.json b/package-lock.json index 8def46925..1910c35b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ml5", - "version": "0.10.1", + "version": "0.10.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 78caa1c98..f3a9a690f 100644 --- a/package.json +++ b/package.json @@ -133,4 +133,4 @@ "face-api.js": "~0.22.2", "onchange": "^6.1.0" } -} \ No newline at end of file +} diff --git a/src/utils/callcallback_test.js b/src/utils/callcallback_test.js new file mode 100644 index 000000000..df60a2b23 --- /dev/null +++ b/src/utils/callcallback_test.js @@ -0,0 +1,80 @@ +import callCallback from "./callcallback"; + +describe("callCallback", () => { + describe("if no arguments are passed", () => { + it("returns undefined", () => { + const result = callCallback(); + expect(result).toBe(undefined); + }); + }); + describe("if nothing is passed to the second argument", () => { + it("returns whatever is in the first argument if one exists", () => { + const mockArg = "yo"; + const result = callCallback(mockArg); + expect(result).toBe(mockArg); + }); + it("returns a promise if it passed as the first argument", async () => { + const mockFunction = greeting => + new Promise(resolve => { + resolve(greeting); + }); + const result = callCallback(mockFunction("yo")); + expect(result instanceof Promise).toBe(true); + expect(await callCallback(mockFunction("yo"))).toBe("yo"); + }); + }); + describe("if a promise object is passed as the first argument and a callback is passed as a second argument", () => { + describe("when the promise is successful", () => { + it("it calls the callback function with the result of the promise", async () => { + const mockFunction = greeting => + new Promise(resolve => { + resolve(greeting); + }); + + const mockCallback = (err, result) => { + return `hello ${result}`; + }; + + const mockUtils = { mockCallback }; + spyOn(mockUtils, "mockCallback").and.callThrough(); + + const result = callCallback(mockFunction("world"), mockUtils.mockCallback); + expect(result instanceof Promise).toBe(true); + + result.then(innerPromise => { + innerPromise.then(callbackResults => { + expect(mockUtils.mockCallback).toHaveBeenCalledTimes(1); + expect(callbackResults).toBe("hello world"); + }); + }); + }); + }); + describe("when the promise fails", () => { + it("it calls the callback function with the error", async () => { + const mockFunction = greeting => + new Promise(resolve => { + resolve(greeting); + }); + + const mockCallback = (err, result) => { + if (err) throw err; + return `hello ${result}`; + }; + + const mockUtils = { mockCallback, mockFunction }; + spyOn(mockUtils, "mockCallback").and.callThrough(); + spyOn(mockUtils, "mockFunction").and.returnValue(Promise.reject(new Error("error"))); + + const result = callCallback(mockFunction("world"), mockUtils.mockCallback); + expect(result instanceof Promise).toBe(true); + + result.then(innerPromise => { + innerPromise.catch(err => { + expect(mockUtils.mockCallback).toHaveBeenCalledTimes(1); + expect(mockUtils.mockCallback).toHaveBeenCalledOnceWith(err); + }); + }); + }); + }); + }); +});