How Does AI Work?

Let’s start to explore how Artificial Intelligence actually works!

There are THREE parts to Artificial Intelligence. 




  • → Past videos you’ve watched
  • → Videos other people watch
  • → What you were just watching
  • → Find videos that are watched by people who are similar to you
  • → Find videos that other people watched after they watched the video you just watched
  • → What videos you might watch

This video is all about the first part, datasets.

Now think how you and your family create data every day using your computer or smartphone. 

Write down your ideas. 

  • Every Google search
  • Words you type into emails
  • Every question you ask Alexa/Siri/OK Google
  • Connected devices – each time you turn on lights, change room temperature
  • Taps you make on your cell phone
  • Anything you buy online
  • Songs you listen to
  • Steps you take walking with your phone
  • Videos you watch

This next video talks about the next parts of AI – patterns and predictions.

How does Youtube suggest videos for you to watch?

What are the datasetpatterns, and predictions for Youtube?

  • → Past videos you’ve watched
  • → Videos other people watch
  • → What you were just watching
  • → Find videos that are watched by people who are similar to you
  • → Find videos that other people watched after they watched the video you just watched
  • → What videos you might watch


Download and fill out the worksheet

Stop and Discuss

Based on the How does AI Work? Activity:

  1. What did you learn about the data?
  2. Did anything surprise you?
  3. Was it hard to figure out which data the AI technology used? Why or why not?
two girls talking
girl holding phone over box and taking picture

What is AI?

This video will get you thinking about artificial intelligence, and how to tell whether something is AI or not.

Let’s play a game to see if we can tell what uses AI… and why!


For each example, choose which one uses AI … and why! 

Base your answers on the questions below.

  • Does it understand or sense things?
  • Can it learn over time?
  • Can it make decisions?
  • Can it interact with humans?
  • Can it do it on its own or is it following commands?


Pick which one you think uses AI.

This alarm clock is set to go off every morning at 6:30am.

alarm clock

This smartwatch can recognize voice commands, monitor your activities and health and give you updates on your day.

This alarm clock is set to go off every morning at 6:30am. 

alarm clock

This smartwatch can recognize voice commands, monitor your activities and health and give you updates on your day.   AI



Pick which one you think uses AI.


dog being vacuumed


cat riding a roomba

Vacuum not AI

dog being vacuumed

Roomba AI

cat riding a roomba


Pick which one you think uses AI.

Remote controlled cards

remote controlled cars racing

BMW i3 parking assistant

auto-assist car parking
image courtesy

Remote controlled cards not AI

remote controlled cars racing

BMW i3 parking assistant AI

auto-assist car parking
image courtesy


Pick which one you think uses AI.

Prosthetic that responds to user’s thoughts

man lifting objects with prosthetic arm

Prosthetic that responds to user’s movement

woman dancing with prosthetic leg

Prosthetic that responds to user’s thoughts   AI

man lifting objects with prosthetic arm

Prosthetic that responds to user’s movement Not AI

woman dancing with prosthetic leg


Pick which one you think uses AI.

Email predictor

Spell checker

spell checker

Email predictor  AI

Spell checker Not AI

spell checker


This video shows how AI can help people in many ways. It also shows how AI can be harmful to humans in some ways

girls coding

Web Apps Using AI Models

  • Train a machine learning model using Python libraries in a Jupyter Notebook
  • Incorporate a trained machine learning model into a Streamlit web app

These are the activities for this lesson:


Another major feature of Jupyter Notebooks, Python, and Streamlit is the ability to train machine learning models and make predictions. 

If you are new to Artificial Intelligence,  you might want to view the AI lessons in this curriculum to learn the basics before jumping into the more advanced coding involved here. You can use a user-friendly machine learning model platform like Teachable Machine to make a model and still incorporate it into a Python web app. 

If you have had some experience with artificial intelligence and working with datasets using Jupyter Notebooks, this is a good next step for you. 

In this lesson, you will learn about some of the Python machine learning libraries, and some of the different machine learning models you can create using Python. 

To review, to create a machine learning model, there are 3 main parts. 




The dataset is your input for the model. It can include text, images, sounds, or poses. We worked with text and numerical data in Unit 2 using Jupyter Notebooks. We will continue to work with text data in this lesson, in the form of a spreadsheet.

Finding Patterns is essentially building the machine learning model using the dataset. Python contains many libraries that will build an AI model from data. In this curriculum, we will use many of the functions from the scikit-learn package. In addition to the libraries it provides, the website contains lots of excellent information about machine learning and the process of building models. It is a great resource to learn more!

Once you have created your model, the model can be used to predict an outcome based on new information. Once again, Python supplies libraries that enable this.


Before your dataset can be sent to the algorithm for building the model, it must be preprocessed, or “cleaned” so that the model building algorithm can work with it and make the most accurate model possible. In fact, the bulk of the work for creating a machine learning model is in the preprocessing. You will need to look carefully at the data to decide what is important, what can be left out, and what needs to be cleaned up.

What does preprocessing involve? With a text-based dataset, here are some things to deal with.


Null Values

Sometimes the dataset contains blank or null values, especially if the data is survey data. Sometimes you will eliminate any rows that have null data.

However, if the number of samples is low, you may not want to eliminate them. Another option is to replace a null value with some other value. It could be zero, or it could be the average of all the other values for that field.


Sometimes the data contains one or two samples that are very different from the rest of the data. This might skew the model. You don't want the outliers to affect how the model is created, so often outliers are eliminated from the dataset.

For example, you might have a dataset where 95% of the samples are people aged 10-30, but you have a few random samples where the people are over 50. Since the vast majority of samples are in the 10-30 age group, you can consider removing the samples from the older age group.


Often the numbers in a large dataset vary, depending on what features are represented. For example, you might have age, that varies from 0 to 70, but then you might have salary, that ranges from 0 to 500,000! The scales are very different, so one feature might count more in the model.

To fix, this, you can standardize the data so it's on a single scale. scikit-learn provides a StandardScaler, which updates each features so the mean is 0 and the standard deviation is 1.

Another thing to consider is a balanced number of samples for each class or label. You want to make sure their are about the same number of each class in your dataset.


AI likes numbers, not necessarily words. So it helps to have all of the data converted to numbers. scikit-learn provides Encoder functions, so you can easily convert a range of possible text values to a range of numbers.

An example could be activity levels, with sample values sedentary, light, moderate, high. Those responses could be encoded to be values 0, 1, 2, and 3, which is much easier for the model building algorithm to handle.


Once you have preprocessed your data, you need to split it into a training set and a testing set. The training set will be used to train and create the model. Then you will test your model using the test set to see how it performs.

There are standard ways to split it (usually 75% for training, and 25% for testing) but you can split it however you want. Again, functions are provided so this is all automated for you. 


The next step is creating the model. A big decision to make is, which algorithm do I use? There are many different supervised learning algorithms to choose from, and it is hard to know which one to use. A good process is to try out several different algorithms and then see which one gives you the best accuracy. 

The first step is to decide whether you need a classification algorithm or a regression algorithm. That depends on what you are trying to predict. 

Classification algorithms are used to predict discrete targets or classes. For example, classifying email as spam or not spam would be a classification problem

Regression algorithms are used to predict something that is along a continuous range. One example would be predicting how much salary a person will be paid. The prediction is a range of numbers and the output could be any value along that range. 

Here are just a few of the popular types of model creation algorithms.

neural network


  • Decision Tree
  • Random Forest 
  • K-Nearest Neighbors
  • Naive Bayes
  • Logistic Regression
  • Support Vector Machine


  • Linear regression
  • Ridge Regression
  • Lasso Regression
  • Polynomial Regression
  • Bayesian Linear Regression
  • Support Vector Regression

Note that some algorithms fall under both types. For example, there is a Decision Tree Classifier as well as a Decision Tree Regressor. And a Support Vector Machine works for classification, and Support Vector Regression works for regression. 

So, how do you decide which one to use? You should research to see what other data scientists use for different situations to see what might for for your model. You should also try out some different algorithms with your data and then find which one provides the best accuracy. You can also tweak parameters for a particular algorithm to see if it returns a more accurate model. 

scitkit-learn provides functions for all of these algorithms, so it’s straightforward to create the model. 


You want your model to be the best it can be, so you need to evaluate its performance. Two common variables in evaulating a model are bias and variance. 

Bias is the difference between the model’s predicted value and the correct value. 

Variance is how much the predictions change when different data is used. 

You want to achieve a good balance between bias and variance.

High bias -> underfitting.

Underfitting happens when the model is too simple to account for the noise in training data. This can happen if there is not enough data or not enough features (columns), or too much noise in the data. If a model doesn’t perform well on both the training data and the testing data, it signals underfitting.

High variance -> overfitting.

Overfitting happens if you train a model on one set of data and it performs very well, but if you then present it with new data, it does not perform well at all. This can happen if the model is overly complex and it tries to fit too closely to the training data. The model may predict very well on the training data, but then performs poorly on testing data.

One technique to check the performance of a model is cross-validation.

Cross-validation means training your model several times, using different splits of training/testing data each time. Your dataset is split into several folds, or subsets. Then one fold is held out as the validation or test set, and the remaining folds are used to train it. This is performed several times, so each time the training and test sets change. 


sciikit-learn also provides a metrics library so you can easily get performance scores for your models. 

  • accuracy score = correct predictions/total predictions
  • precision = true positives/(true positives + false positives)
  • recall = true positives/(true positives + false negatives)
  • F1 score = (2 x precision x recall)/(precision + recall)
  • specificity = true negative/ (true positives + false negatives)
  • confusion matrix  – shows true positive, true negative, false positive, and false negative counts

By checking metrics from various algorithms, you can choose the best model. 


Once you have a model that you are satisfied with, you then want to use it in your app. 

It is common practice to do the preprocessing, creation, and evaluation of your model using Python, in an environment like Jupyter Notebooks. From there, you can export your model as a file.

Then, within your Streamlit app, you can load the model and use it to make predictions. 

In this lesson’s activities, you will go through this entire process using a stroke risk dataset. You will see how to preprocess the data, create models using different algorithms, and then use a model in a simple Streamlit app to predict the risk of stroke, given some input characteristics. 


Estimated time: 60 minutes

Explore a Stroke Risk Dataset to build an AI model

Follow this video to:
  1. Download a stroke prediction dataset from Kaggle.
  2. Work with the data in a Jupyter Notebook to:
    • Review the data
    • Preprocess the data to prepare it for the model
    • Create some different models
    • Evaluate and choose a model for your app
    • Export the model
Download Notebook


Try out a different model than the ones in the Jupyter Notebook. 

  1. Research the scikit-learn website for other classification algorithms, and look at other model-building examples on Kaggle.
  2. Choose one algorithm and add the code to your notebook to create the model.  
  3. Use the scikit-learn metrics to check for accuracy. 

How does your model perform? Is it better than any of other algorithms in the notebook?


Estimated time: 45 minutes

Use your model in a Streamlit App

Follow this video to make a web app that will make a stroke risk prediction based on user input.


The Iris dataset is a classic dataset that classifies iris flowers into 3 species (setosa, versicolor, and  virginica) based on the petal and sepal dimensions.

  1. Do some research on the dataset to learn its features and targets. 
  2. You can download the dataset and create your own model or use this model (pickle file) created using K-nearest neighbors. Note that no scaler was needed for this dataset.  The pickle file contains just the model.
  3. Import the model and create a Streamlit app to predict the iris species based on the four dataset features.


Here are some pretty amazing examples from Technovation participants who used Python and Streamlit to build web apps incorporating machine learning models. 


You have gone through the entire process of preprocessing a dataset, building several models, and evaluating and choosing one to use in an app.  That is A LOT to learn in one lesson!

What type of model do you think you will need for your solution - classification or regression?
What parts did you find difficult to understand?
What steps can you take now to learn more so you can build your solution?
Previous slide
Next slide


  • Preprocessing – taking a dataset and making sure the data in it is suitable to train a machine learning model with
  • Classification algorithm – an algorithm used to train a machine learning model that will classify or predict discrete values
  • Regression algorithm – algorithm used to train a machine learning model to predict a value on a continuous range
  • Bias – the difference between the model’s predicted value and the correct value, due to incorrect assumptions that simplify the model
  • Variance – the amount of variability in model predictions, when a model is unable to generalize when faced with new data
  • Overfitting – when the model fits too well to the training data that it cannot predict well on new data, caused by high variance in the model
  • Underfitting – when a model is simplified too much and does not perform well on either training or testing data, caused by high bias or assumptions in the model


Machine Learning 


girl looking at phone with robot floating above

All About AI

  • Learn the basics of how artificial intelligence works

These are the activities for this lesson:


Earlier, you learned how artificial intelligence is being used in different areas to make an extraordinary impact on our daily lives. Let’s go a little deeper into what it is and how it works.

True artificial intelligence is not quite here yet. There doesn’t yet exist a system that completely thinks and acts like a human. When we think of AI in our everyday lives, we are really thinking about machine learning. 

When we talk about AI in this curriculum, we’ll really be talking about two subsets of Artificial Intelligence, Machine Learning and Generative AI.

What are they?

face recognition

Machine Learning

is a subset of AI where a machine (computer) "learns" to identify patterns so it can make predictions.

That's how Youtube can predict the next video you might like to watch, or Facebook can identify your face in an image.

generated girl with robot

Generative AI

can generate text, images, and sounds. It uses Large Language Models to be able to create content based on lots and lots of existing data. 

ChatGPT and DALL-E are current popular examples of generative AI.

Let’s dive deeper into Machine Learning.





Source: “Learning about Artificial Intelligence: A hub of MIT resources for K-12 students”, MIT Media Lab


AI needs a LOT of data to learn from.  AI uses a dataset, which is just a very large set of data! Technological advancements have allowed more information to be gathered faster than ever before. That’s one reason AI has made such huge advances in the past few years.


  • learns from the data
  • and eventually can find patterns on its own
  • when it takes in new data
    • it can make a prediction
    • based on the patterns.


Where does AI get its data? Well, it gets a lot from you and me.

In your household, what sorts of data do you create every day through technology?

girls discussing


Let’s step through how Google Maps uses AI to give you directions to where you want to go. Hover over each box to reveal how Google Maps addresses each part.



Google Maps takes the following inputs to make a prediction.
  • current location
  • destination
  • mode (walk, car, public transport)
  • traffic



Google Maps is constantly learning from people who use Google Maps. That data are fed into the learning algorithm so that Google Maps can continue to improve upon its predictions



Based on its current knowledge, Google Maps predicts the best route for you to take to your destination. It might give you different options. When you choose one, it continues to learn from your choice


Now you try it!

Step through the process with Youtube.

  1. What is the dataset?
  2. How does Youtube learn?
  3. What does it predict?



Estimated time: 15 minutes

Explore some of the websites below to get a taste of what AI can do.

As you explore, consider:
  • Could you take the concept in front of you and apply it in a different context?
  • What sort of data do you think is needed to make these applications work?
Instrument Playground - based on an image, AI generates what it believes you would hear if you were actually there.
AutoDraw - takes your doodling and predicts what it is you’re trying to draw, very quickly!
X Degrees of separation - takes two art pieces and shows us a bridge of similar artworks that connects the two together.


Now that you have a glimpse of what it takes to create artificial intelligence, you might want to think about the problem you are solving, and how AI might be useful.

Sunset and reflection over lake
Can you think about your problem and possible solution in terms of the three parts of AI - data, pattern, prediction?
How would you address all three parts in your solution?
Previous slide
Next slide


  • Artificial Intelligence (AI) – machines/programming that can do tasks normally thought to be done only by humans
  • Machine Learning – the subset of AI where a technology is trained with data and “learns” to recognize patterns in order to make predictions
  • Generative AI – technology that has the ability to create content like text, images, and and sound
  • Large Language Model – an AI model that predicts and generates text, trained using enormous amounts of data
  • Datasets – information that is used to teach AI to recognize patterns and predict something


Want to explore some more cool AI?

girl with headphones working at desktop computer

Find Patterns with AI

  • Train a machine learning model to predict something

These are the activities for this lesson:


Recall that Articifical Intelligence, specifically Machine Learning, has 3 main parts.


Find Patterns

Make Prediction

In this lesson, we’re going to focus on the second part, Find Patterns, by training our own AI model that will be able to make a prediction.

There are many free online platforms where you can train an AI model, using supervised learning. 

Supervised learning is just as it sounds – you supervise how the model learns by telling it the correct answer.

For example, say you want an AI model to tell if a picture is a dog or a cat.

dog's face
cat's face

Your dataset will be lots and lots of pictures of dogs and cats.

You will help train the model by telling it which pictures are dogs and which are cats


Your model will predict, or classify something. Often these models are called classification models, for that reason. 

First steps:

  1. What you are classifying? Are they images, text, sounds? This is your data type.
  2. What are the different possible classifications?  For example, dogs and cats. These are your classes. They are also sometimes referred to as labels.
  3. Gather the appropriate data to train your model. Find lots and lots of varied data to represent each class. For example, lots and lots of pictures of different types of dogs and cats!
Teachable Machine screenshot training dogs and cats


There are many free and open source platforms available to create AI classification models. 

We have curated a list of programs and platforms where you can:

  • build your model to make a prediction
  • then use your model in a mobile or web app to perform an action based on the prediction

Here is a quick overview of what each platform can classify and integrate with.

Platform Classification Types Technovation Integration
Teachable Machine by Google text, sounds, poses App Inventor, Python, other integrations possible
MachineLearningForKids images, sounds, text, numbers Python
MIT App Inventor images, sounds, poses App Inventor
Ximilar images Thunkable, App Inventor, wep apps, using APIs


Estimated time: 30 minutes

Build a Rock, Paper Scissors model

Follow the worksheet to use Google's Teachable Machine platform to build a machine learning model to recognize hand signs of rock, paper and scissors.

Then see your model in action with a simple pre-built javascript interaction.
Open worksheet


You’ve made your first AI model! This should give you a glimpse into the process for making an AI model. All the model creation platforms work in a similar way, although the interfaces may differ slightly.

reflection in building
Was your model successful in detecting rock, paper or scissors?
Was it made with a "good" dataset?
How could you make the dataset better?
If a friend or person in a different location from you used your model and project, would it perform as well? Why or why not?
Previous slide
Next slide


  • AI (or machine learning) Model – artificial intelligence that is trained on a dataset to recognize patterns to predict or classify something
  • Supervised Learning – machine learning where a model is trained by telling it correct or incorrect result
  • Class – a label that is provided to an AI model so it learns how to classify inputs by its class


If you want to learn more about artificial intelligence and machine learning, here is a great playlist from Daniel Schiffman of New York University

black and white images

AI: Datasets

  • Learn about different types of datasets
  • Start to plan the dataset for your project AI model that will predict something

These are the activities for this lesson:


The first step in creating an AI model that can classify something is to plan the dataset.

Healthy Datasets

right arrow

Lots of data

Different examples of data

The right kind of data

right arrow

Correct actions or decisions


Keep the following qualities in mind when gathering examples for your dataset.


The more examples you can give the model, the better it will perform. Provide at least 50 examples for each class.

balanced scales


You should have about the same number of examples for each class, in order to prevent bias for one over the other.



Keep a portion of your examples separate to test the trained model. You will need some examples that were not used to train the model to test if your model is accurate.
10-20% of data should be test data.


You also want to include varied examples.

For example, say you are creating an AI model to detect if someone is wearing a face mask or not. You should gather images that reflect varied examples:


  • Different types and colors of masks
  • Different people – genders, ethnicities, ages
  • Different backgrounds – indoors, outdoors, light, dark
  • Different head angles
  • Different placement of head in frame – close, far, left side, right side

What if you only trained your model using images of white men with blue surgical masks for your mask class? What happens when a female of color wearing a purple mask uses your model? How do you think it will be classified? Will your model perform well or not?

African American woman with mask


A dataset must also be the right kind of data. Make sure you choose the data type that is right for your project! The options are:

excel icon


statistical data, demographic information, sensor data

text document


messages, social media posts, books, articles, websites

sound wave


music, recordings, voices

image icons


faces, places ... anything!


Determining what goes into your dataset gives you immense power!

Be careful to use Determining what goes into your dataset gives you immense power!

Be careful to use lots of data, different data, and the right type of data.

Otherwise, your AI model will

  • not be very accurate
  • could make bad predictions
  • take the wrong action.

Taking the time to collect data that will make for a healthy dataset is critical to a successful model.

girl with fist in the air


There are 3 ways to collect data for training your model.


There are many low cost sensors that can connect to small microcontrollers and provide your project with data. Here are some sensors that could be used.





Light sensor

Pressure sensor

Air quality sensor

Infrared Thermometer

Proximity sensor


Estimated time: 45 minutes

Follow the instructions in the worksheet to outline:

  • What data you want to collect.
  • Where you will collect the data for your dataset. Will it be community, sensors, or public datasets?
  • How will you collect the data? What will the classes or labels be for your model?
  • How many examples for each class? 50 per class should be a minimum.
Open worksheet


You now have a plan for your dataset! As you start to gather the examples for your dataset, keep them safe and well organized.

Don’t forget to keep a portion of the dataset for testing! About 10-20% should be kept separate for testing.

reflection in lake


  • Datasets – large sets of data that are used to teach AI to recognize patterns and predict something

  • Sensor – a device that detects changes in the environment and is used to monitor that information within an electronic system

  • Microcontroller – small computer on a single integrated chip, used in larger computers and other systems such as appliances, vehicles, and robots


Hardware and Sensors

For a comprehensive list of sensors, check out this Wikipedia article.

This video gives good information on the microcontroller hardware we recommend for projects using sensors.

This video tutorial shows you how to access a public dataset on Kaggle.


girl at computer with mentor smiling over her shoulder

AI: Train your Model

  • Decide on a platform to train your AI model
  • Gather your initial dataset and start training your AI model for your project

These are the activities for this lesson:


By now you should have gathered your data for your dataset. As a reminder, there are three ways of collecting data:

  1. Collect training data from your community
  2. Invention gathers data with sensors or user input
  3. Use data from public datasets for training data


You also should have decided on what type of data you want to use in your dataset – images, text, sounds, or poses. 

Your dataset should meet the following criteria:

  • The right kind of data
  • Lots of examples
  • Varied examples – diverse and representative (unbiased)


Input data

By uploading it, or through a webcam for images


Run the data through a learning algorithm.


Using new inputs, check if your model is accurate.


The platform you choose should allow you to:

You are not limited to these platforms, but these are simple and user friendly options for integrating with a mobile or web app.

The best platform for your project may depend on the type of data in your dataset, as not every platform can train every type of data. 

Try out one or more of the tutorials from one or two platforms to see which platform will help you achieve the goals for your project.


Classification types: images, sounds, poses

Technovation Integrations: App Inventor, Python, other integrations using APIs

Here are three tutorials to try out Teachable Machine using different data types.


Classification types: images, sounds, text, numbers

Technovation Integrations: App Inventor, Python

Machine Learning for Kids has many example tutorials and worksheets to learn more. 

You will need a mentor or teacher to sign up for a teacher account. Then they can set up a student account for you.


Check out these examples/tutorials using MachineLearningForKids.


Classification types: images, sounds, poses, face mesh

Technovation Integrations: App Inventor mobile apps

If you are already using App Inventor as your coding platform for your project, this is a good option.

Here are some tutorials to get started:


Classification types: images

Technovation Integrations: Thunkable, web apps (using APIs)

Although there are other options, this is a good one if you are using Thunkable as your coding platform.

Check out the first half of this tutorial to learn how to use Ximilar. The second half will be shown in the next unit, when you integrate your model with Thunkable.

The platforms above are just recommendations for easy on-ramps to training and using AI models.

There are many more advanced AI tools available. Some are listed in the Additional Resources section. They may require using advanced languages like Java, Python, or Swift and will most likely entail using APIs (Application Programming Interface).


Estimated time: 60 minutes

Train your AI model using your dataset

  1. Choose the appropriate platform for your project.
  2. Train your AI model using your dataset.
    • If you haven’t completely gathered all the examples for your dataset, add what you have.
    • Add more as you collect more data.
    • Save your project/model so you can return to it later!
  3. After training your AI model, test it with some additional examples. These test examples should be different from the training examples you used.
  4. If your model is not very accurate (over 70%), add more training examples, retrain, retest.


This activity is just about training the model.

In the next unit, you’ll on integrate your model into a software platform to turn into a working app.

Why is your chosen platform a good choice for your project?
What do you hope to achieve with your AI model now that you have built it?
Are you confident the platform you chose will help you achieve your goals?
Previous slide
Next slide


  • Platform – software or website that allows its users to perform a task or use a tool
  • Classification – Machine learning model used to identify or categorize different data


Here are some more advanced platforms for building AI models.

Note: If you decide to use these tools, be sure to double check the pricing. Some tools are free to use depending on how many users use your app.

two people with laptops on knees

AI: Software Options

  • Learn how to integrate your machine learning model into an app
  • Start to code your app integration

These are the activities for this lesson:


By now, hopefully your team has 

  • trained its AI model using a healthy dataset. 
  • tested the model with new and diverse data

But you can’t just leave it there! 

You want your model to take action based on the prediction it makes. 

You will need to implement your model into an app to make it useful.

brain hovering over a computer chip


Which platform you use to code your app will depend on:

  1. what your mobile app coding platform  preference is
  2. which platform you used to train your model

Below are the machine learning platforms discussed in Unit 5. Click on each one to see some options for integrating the model into an app. 

Teachable Machine is a very versatile platform. You can save your model to the cloud or save it as a file, so you have many options for integration with coding platforms.

This video describes how to export your model.

  • App Inventor has a Teachable Machine Image Classification extension, contributed by Fabiano Oliveira, that can be downloaded and imported in the Extension drawer.
  • Teachable Machine provides  code snippets to integrate with Tensorflow, a machine learning library. It provides 3 code snippet options:
    • Tensorflow.js – Javascript language will allow you to create a webpage or web app.
    • Tensorflow – Python language to create web apps.
    • Tensorflow Lite – Java language to create mobile apps. 

All 3 code snippets provide you with a model file and code to copy. Depending on the language, you might have to install libraries and code editors. Links to instructions are provided with the code snippet. 

These are the steps for using the Tensorflow.js option:

    1. Copy the code and paste it into a new blank text file on your computer.
      teachable machine code snippet
    2. Save it as index.html (or something else with a .html extension). 
    3. Open the file in a web browser. It will provide a basic interface where you can classify an image captured with the webcam based on your model.
    4. If you want to be able to upload an image to classify, instead of the webcam, this code works.  (Courtesy Chris Hoyean Song) Just make sure to copy your model URL from your original code snippet to this file. 

The Tensorflow and Tensorflow Lite options will require different installation of software and coding libraries. Check the github site for further instructions.

Technovation Integrations: Python

Currently the only integration for Machine Learning for Kids that is acceptable for Junior and Senior division is Python. 

To learn more about integrating your Machine Learning for Kids model to Python, try one of the worksheets on this page. Select Python from the Make Type dropdown. 

Extensions in App Inventor are external components that add functionality to an app, but are not part of the core App Inventor components.

Once you’ve trained your image or sound model using App Inventor’s classifier websites, you’ll use an extension in App Inventor to bring your model to life in your mobile app.

All the App Inventor extensions are available here and can be downloaded and imported into App Inventor to use. Choose the appropriate extension for your model.
  1. Click on Extension in the Designer Palette.
  2. Click on Import extension.
  3. Click Choose File and choose the extension file you downloaded from the extensions page above.
  4. Click the Import button to import the extension and its blocks.

You also need to add a WebViewer component to your project. It can be found in the User Interface drawer.

In the example below, we show how to set up the Image Classifier, but it works pretty much the same with the Audio Classifier, if your model involves sounds.

To link your model from the classifier, first download the model from the classifier website, and then, 

  1. Select the PersonalImageClassifer component.
  2. In the Properties panel, click “None” under Model and upload the downloaded model.mdl file. (The file can be renamed anything, but must have the .mdl extension in its name).
  3. Click “None” under WebViewer and select the WebViewer component just added to the project.

screenshot of webviewer in app inventor

Note the property “InputMode”, which can be either Video or Image. If you choose video, it will continuously try to classify the video feed that appears in the WebViewer. If you choose Image, you will have to add a Camera or ImagePicker component to get an image to classify. You will still need the WebViewer component for the image classification to work.

inputmode for webviewer

In the following videos, watch how to add the healthy and diseased fruit model from Week 5 to App Inventor to create a mobile app that can identify healthy vs diseased fruit using the phone camera.

In part 2 you will code the blocks for the classifier.

Models made with Ximilar can be used with an API to integrate it into an app.

You can use the Web API component in Thunkable to integrate an external model from a platform like Ximilar into an app.

Watch the second part of Pratham’s video to incorporate his coral AI model from Week 5 into a Thunkable mobile app.


Estimated time: 60+ minutes

Integrate based on your chosen platform

  1. Review what is needed for your particular platform to add your trained AI model to a project.
  2. Create a new project in your selected platform and add your model. How you do it will depend on the process for your particular platform.
  3. Take action! Add components and code to the platform so your project takes an action based on the prediction from your model.


You’ve started to code the action part of your AI app! Here is where you can see the results of your model and what it can really do!

Now is a good time to check in with your Project Plan/Canvas to see how your project is progressing. You might want to adjust timelines and tasks based on the platform you are using and the steps you will need to achieve the goals for your project.

Once you get your code working, it’s also time to check back in with your users. Find some people to test out your app and provide feedback.



  • Software – term for programs or applications that run on a computer or device
  • Extensions – software bundles that add functionality to existing programs


Marshmallow sorter using Teachable Machine and Coral.

Check out these videos on more advanced AI tools!