You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+70-68
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,18 @@
2
2
3
3
One essential and last phase of the CRISP-DM data framework is deployment. The key focus in this phase is the usability of the developed model by intended users or customers. Depending on the type of solution and use case, this can involve deploying and integrating the model on any medium like the web, a mobile application, a hardware-embedded system, etc. While this might "sound easy,” many beginner ML engineers find it daunting to deploy their projects on the web for their intended users to test and for their solutions to solve their users' problems.
4
4
5
-
In this workshop, Bolaji will introduce you to ML model deployment by showing you the steps and processes involved with turning a machine learning model into an API with Python and Flask, testing the API, building a web application, and deploying it to the cloud for global usage. We would also discuss several other alternative JavaScript frameworks and tools you can consider.
5
+
In this workshop, Bolaji will introduce you to machine learning model deployment by showing you the steps and processes involved with turning a machine learning model into an API with Python and Flask, testing the API with Postman, building a web application, and deploying it to the cloud for global usage. We would also discuss several other alternative Python/JavaScript frameworks and tools to consider.
6
6
7
7
---
8
8
9
-
This repository contains the workshop materials, lesson notes, machine learning model notebook, serilized model, web application code, and links to further resources. You can follow the workshop lessons and build the project yourself or use the materials to learn at your own pace.
9
+
This repository contains the workshop materials, lesson notes, machine learning model notebooks, serilized models, backend API/web application code, and links to further resources. You can follow the workshop lessons and build the project yourself or use the materials to learn at your own pace.
10
10
11
11
In this workshop, we will build the following:
12
12
13
-
- A simple machine learning model that predicts the personality type of an individual based off their messages in conversations using Python, Scikit-learn, and other libraries.
14
-
- A web application and API that consumes the model using HTML, CSS, JavaScript, and Flask.
15
-
- A web application and API that consumes the model using HTML, CSS, JavaScript, Nextjs, and Flask.
16
-
- A web application and API that consumes the model using HTML, CSS, JavaScript, and FastAPI.
17
-
- A web application and API that consumes the model using HTML, CSS, JavaScript, Nextjs, and FastAPI.
13
+
- A simple machine learning model that predicts the personality type of an individual using Python, Scikit-learn, and other libraries.
14
+
- A backend and API for the model using Python and Flask.
15
+
- A web application that consumes the model/API using HTML, CSS, JavaScript, and Flask.
16
+
- A web application and API that consumes the model/API using HTML, CSS, JavaScript, Nextjs, and Flask.
18
17
- An AI web application using Nextjs and OpenAPI.
19
18
20
19
[Demo GIF]
@@ -35,19 +34,19 @@ In this workshop, we will build the following:
35
34
36
35
## 🎧 Overview
37
36
38
-
Workshop duration: three (3) hours.
37
+
Workshop duration: ~three (3) hours.
39
38
40
39
At the end of this workshop; you should be able to:
41
40
42
41
- Explain what machine learning and a machine learning model are to your friends and family.
43
42
- Understand how the CRISP-DM data framework works.
44
43
- Understand the fundamentals of building a machine learning model using the Python programming language.
45
-
- Understand how to export and serialize a machine learning model.
44
+
- Understand how to serialize (export/import) a machine learning model.
46
45
- Understand how to turn a machine learning model into an API using the Flask Python framework.
47
-
- Understand how to build a web application using the FastAPI Python framework.
48
-
-
46
+
- Understand how to build a web application using the Flask Python framework.
49
47
- Understand how to build a web application using the Nextjs JavaScript framework.
50
-
- Understand how to deploy a web application to the cloud using Fly.
48
+
- Understand how to deploy a Python/Flask application to the cloud using Fly.
49
+
- Understand how to deploy a Nextjs/Flask application to the cloud using Vercel.
51
50
52
51
---
53
52
@@ -73,7 +72,7 @@ To make the workshop a smooth process, we will use [Google Colab](https://colab.
73
72
74
73
But if you prefer local (I strongly advise against this; at least for this workshop), you should install [Anancoda](https://anaconda.com/download?utm_source=ba-deploy-ml-web-workshop) to use Jupyter Notebook on your local computer. You will need to install and import all the required packages yourself too and resolve any conflicts that might arise.
75
74
76
-
> **Note**
75
+
> [!NOTE]
77
76
>
78
77
> [Jupyter Notebooks](https://jupyter.org?utm_source=ba-deploy-ml-web-workshop) allow you to combine executable code and rich text in a single document, along with images, HTML, LaTeX, and more.
79
78
@@ -86,9 +85,10 @@ You should have the following software and packages installed on your computer.
86
85
<summary>Git and GitHub</summary>
87
86
<br />
88
87
89
-
> [Git](https://github.com/pallets/flask?utm_source=ba-deploy-ml-web-workshop) is a free and open-sourced distributed version control system.
90
-
>
91
-
> [GitHub](https://github.com?utm_source=ba-deploy-ml-web-workshop) is a code hosting platform for version control and collaboration.
88
+
We will install/use the following packages:
89
+
90
+
-[Git](https://github.com/pallets/flask?utm_source=ba-deploy-ml-web-workshop): a free and open-sourced distributed version control system.
91
+
-[GitHub](https://github.com?utm_source=ba-deploy-ml-web-workshop): a code hosting platform for version control and collaboration.
92
92
93
93
Download and install Git from [this website](https://git-scm.com/downloads?utm_source=ba-deploy-ml-web-workshop) for all operating systems or follow this [installation guide](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git?utm_source=ba-deploy-ml-web-workshop).
94
94
@@ -102,80 +102,80 @@ git --version
102
102
103
103
Next, create a [free GitHub account](https://github.com/signup?utm_source=ba-deploy-ml-web-workshop) if you don't have one already.
104
104
105
-
> **Note**
105
+
> [!NOTE]
106
106
>
107
107
> Bonus: If you're a student, you should check out the [GitHub Student Developer Pack](https://education.github.com/pack?utm_source=ba-deploy-ml-web-workshop), which gives students free access to the best developer tools (paid tools/services/courses for free) in one place so they can learn by doing.
108
108
109
109
</details>
110
110
111
111
<details>
112
112
113
-
<summary>Python 3 and PIP</summary>
113
+
<summary>Postman Desktop App or VSCode Extension</summary>
114
114
<br />
115
115
116
-
> [Python](https://python.org?utm_source=ba-deploy-ml-web-workshop) is a general-purpose programming language that lets you work quickly and integrate systems more effectively.
117
-
>
118
-
> [PIP](https://pypi.org/project/pip?utm_source=ba-deploy-ml-web-workshop) is a package manager for installing Python packages or modules.
119
-
120
-
Download and install Python 3 from [this website](https://python.org/downloads?utm_source=ba-deploy-ml-web-workshop) for all operating systems or follow this [installation guide](https://realpython.com/installing-python?utm_source=ba-deploy-ml-web-workshop).
121
-
122
-
Once installed successfully, confirm the version using the command:
123
-
124
-
```bash
125
-
python --version
126
-
127
-
or
128
-
129
-
python3 --version
130
-
```
131
-
132
-
If Python is installed correctly, you should have PIP installed. If it isn't, follow the steps in [this guide](https://pip.pypa.io/en/stable/installation?utm_source=ba-deploy-ml-web-workshop) to install PIP.
116
+
We will install any of the following:
133
117
134
-
Hint:
118
+
-[Postman Desktop App](https://github.com/pallets/flask?utm_source=ba-deploy-ml-web-workshop): a desktop that allows you use Postman to send API requests.
119
+
-[Postman VSCode Extension](https://github.com?utm_source=ba-deploy-ml-web-workshop): a VSCode extension that allows you use Postman to send API requests from within VS Code.
135
120
136
-
```bash
137
-
python get-pip.py
138
-
```
121
+
Download and install the Postman Desktop Client or VSCode Extension from [this website](https://www.postman.com/downloads?utm_source=ba-deploy-ml-web-workshop) for all operating systems.
139
122
140
123
</details>
141
124
142
125
<details>
143
126
144
-
<summary>Flask</summary>
127
+
<summary>Python and PIP</summary>
145
128
<br />
146
129
147
-
> [Flask](https://github.com/pallets/flask?utm_source=ba-deploy-ml-web-workshop) is a lightweight Python micro framework for building web applications.
130
+
We will install the following packages:
148
131
149
-
Install Flask using the command below:
132
+
-[Python](https://python.org?utm_source=ba-deploy-ml-web-workshop): a general-purpose programming language that lets you work quickly and integrate systems more effectively.
133
+
-[PIP](https://pypi.org/project/pip?utm_source=ba-deploy-ml-web-workshop): a package manager for installing Python packages or modules.
150
134
151
-
```bash
152
-
pip install -U Flask
153
-
```
135
+
Download and install Python 3 (`>3.10.12`) from [this website](https://python.org/downloads?utm_source=ba-deploy-ml-web-workshop) for all operating systems (this will come with PIP in-built).
136
+
137
+
> [!IMPORTANT]
138
+
>
139
+
> Please specifically download and install a version `3.10.12` or higher (I'm using `3.11.5`). Google Colab will install version `3.10.12` which we will use to develope a machine learning model and anything less on your local machine will result in errors when using the serilized model.
154
140
155
141
Once installed successfully, confirm the version using the command:
156
142
157
143
```bash
158
-
flask --version
144
+
python3 --version
159
145
```
160
146
147
+
If Python is installed correctly, you should have PIP installed. If it isn't, follow the steps in [this guide](https://pip.pypa.io/en/stable/installation?utm_source=ba-deploy-ml-web-workshop) to install PIP.
148
+
161
149
</details>
162
150
163
151
<details>
164
-
<summary>FastAPI</summary>
152
+
153
+
<summary>Other Python Packages</summary>
165
154
<br />
166
155
167
-
> [FastAPI](https://github.com/tiangolo/fastapi?utm_source=ba-deploy-ml-web-workshop) is a a modern, fast (high-performance), web framework for building APIs with Python 3.7+ based on standard Python type hints.
156
+
We will install the following packages:
168
157
169
-
Install FastAPI and the required [Uvicorn](https://uvicorn.org?utm_source=ba-deploy-ml-web-workshop) ASGI server using the command below:
158
+
-[Python Dotenv](https://pypi.org/project/python-dotenv?utm_source=ba-deploy-ml-web-workshop): a package that reads key-value pairs from a `.env` file and can set them as environment variables.
159
+
-[Scikit-Learn](https://scikit-learn.org/stable?utm_source=ba-deploy-ml-web-workshop): a free software machine learning library for the Python programming language, including various classification, regression, and clustering algorithms.
160
+
-[Flask](https://github.com/pallets/flask?utm_source=ba-deploy-ml-web-workshop): a lightweight Python micro framework for building web applications.
161
+
-[FastAPI](https://github.com/tiangolo/fastapi?utm_source=ba-deploy-ml-web-workshop): a modern and fast web framework for building APIs with Python 3.7+ (with the required [Uvicorn](https://uvicorn.org?utm_source=ba-deploy-ml-web-workshop) ASGI server).
Once installed successfully, confirm the version using the command:
176
170
177
171
```bash
178
-
pip show fastapi
172
+
pip3 show python-dotenv
173
+
174
+
pip3 show scikit-learn
175
+
176
+
pip3 show flask
177
+
178
+
pip3 show fastapi
179
179
180
180
uvicorn --version
181
181
```
@@ -187,9 +187,10 @@ uvicorn --version
187
187
<summary>Nodejs and NPM</summary>
188
188
<br />
189
189
190
-
> [Nodejs](https://nodejs.org?utm_source=ba-deploy-ml-web-workshop) is an open-source, cross-platform JavaScript runtime environment.
191
-
>
192
-
> [NPM](https://npmjs.com?utm_source=ba-deploy-ml-web-workshop) is a package manager for installing JavaSript packages or modules.
190
+
We will install the following packages:
191
+
192
+
-[Nodejs](https://nodejs.org?utm_source=ba-deploy-ml-web-workshop): an open-source, cross-platform JavaScript runtime environment.
193
+
-[NPM](https://npmjs.com?utm_source=ba-deploy-ml-web-workshop): a package manager for installing JavaSript packages or modules.
193
194
194
195
Download and install Nodejs and NPM from [this website](https://nodejs.org/en/download?utm_source=ba-deploy-ml-web-workshop) for all operating systems or follow this [installation guide](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm?utm_source=ba-deploy-ml-web-workshop).
195
196
@@ -205,14 +206,15 @@ npm --version
205
206
206
207
<details>
207
208
208
-
<summary>Reactjs 18 and Nextjs 13</summary>
209
+
<summary>Reactjs and Nextjs</summary>
209
210
<br />
210
211
211
-
> [Reactjs](https://react.dev?utm_source=ba-deploy-ml-web-workshop) is an open-source web and native JavaScript library for building user interfaces.
212
-
>
213
-
> [Nextjs](https://nextjs.org?utm_source=ba-deploy-ml-web-workshop) is an open-source React web development framework.
212
+
We will install the following packages:
213
+
214
+
-[Reactjs](https://react.dev?utm_source=ba-deploy-ml-web-workshop): an open-source web and native JavaScript library for building user interfaces.
215
+
-[Nextjs](https://nextjs.org?utm_source=ba-deploy-ml-web-workshop): an open-source React web development framework.
214
216
215
-
Automatically create a project with the latest version of Reactjs and Nextjs using the `create-next-app` command below:
217
+
Automatically create a project with the latest version of Reactjs18 and Nextjs13 using the `create-next-app` command below:
-[How to Deploy a Machine Learning Model to the Web](https://blog.bolajiayodeji.com/how-to-deploy-a-machine-learning-model-to-the-web?utm_source=ba-deploy-ml-web-workshop)
0 commit comments