About Lesson
Using Teachable Machine Models in Scratch
Apps used:
- Scratch mod with AI extensions – https://playground.raise.mit.edu/create/
2. Teachable Machine – https://teachablemachine.withgoogle.com/
Introduction
Once you’ve trained a machine learning model using Teachable Machine, it’s time to bring it to life in practical applications. This article explains how to integrate your model into Scratch, turning it into a computer vision controller for games and multimedia projects.
Setting Up Scratch for AI Integration
Step 1: Access the Modified Scratch Version
- Visit Playground Raise, a modified Scratch platform with AI extensions.
- Add the Teachable Machine extension to enable ML model integration.
Step 2: Import Your Model
- Use the Teachable Machine block to paste the model’s URL, generated during the training process.
- Confirm that the model is active by checking the green light indicator.
Building an Interactive Application
Example: Sprite Movement
- Connect the Model Prediction Block:
- Use the
forever
loop to display the model’s predictions (e.g., “Left,” “Right,” “Nothing”) through thesay
block.
- Use the
- Add Motion:
- Create conditions for movement:
- If the prediction is “Left,” move the Sprite left.
- If the prediction is “Right,” move it right.
- If “Nothing,” reset its position.
- Create conditions for movement:
Extending Your Project
- Create Games: Use gestures to control falling object games, car driving simulations, or other creative applications.
- Enhance Conditions: Add more gestures or refine the logic for smoother interactions.
Benefits of Using Teachable Machine with Scratch
- Interactive Learning: Combines coding, machine learning, and creative thinking.
- Ease of Use: Simplifies complex AI concepts for students of all levels.
- Limitless Possibilities: Encourages experimentation with multimedia projects.
Conclusion
By integrating Teachable Machine models into Scratch, students and educators can explore endless possibilities for creating interactive, AI-powered projects. This hands-on approach bridges the gap between AI theory and practical application, sparking creativity and innovation.