There are many ways to make web interfaces to allow interaction with Machine Learning models and we will cover two of them.
Now that you know how to build some Machine Learning models, it is the time to discover how to embeded it into a web app with a user-friendly interface. You have already saw, of course, some ML tools and you maybe played with it. If so, you know that it is much more interesting to interact with a ML model through a beautiful interface than using a notebook, especially when you are not an expert of this domain.
In this project, we aim to help you to discover how to embed a ML model into a web app to interact with it much easier, by inputing the required information, making predictions and showing the result.
You will have a minimal interface demo with Gradio & Streamlit, this will just serve you to make sure that everything works correctly. Then, you will have to make your own interfaces, those allowing you to interact with a Machine Learning model, that is to say:
- Pass values through the interface;
- Recover these values in backend;
- Apply the necessary processing;
- Submit the previously processed values to the ML model to make the predictions;
- Process the predictions obtained and display them on the interface.
Your task is to understand the frameworks and build your app integrating a ML model. Clone this repository to use it as a template, do not forget to change the readme at the end of the project. Your work should follow these next steps.
-
Build a Streamlit app, during 2 first weeks, to embed the regression model you built a few weeks ago.
-
Build a Gradio app, during 2 last weeks, to embed the classification model you built a few weeks ago.
Upon completion of your project, you are required to write a blog post on your thought process on medium, LinkedIn, personal blog, or any other suitable blogging site.
Streamlit:
-
Excellent: Have an that works correctly with a nice and personalized interface.
-
Good: Have an app that launches, makes prediction and shows result.
-
Fair: Have an app that launches but having bugs regarding prediction or interface.
Gradio:
-
Excellent: Have an that works correctly with a nice and personalized interface.
-
Good: Have an app that launches, makes prediction and shows result.
-
Fair: Have an app that launches but having bugs regarding prediction or interface.
You have two ways in order to setup and run this project.
For manual installation, you need to have Python3 on your system. Then you can clone this repo and being at the repo's root :: friendly_web_interface_for_ML_models> ... follow the steps below:
-
Windows:
python -m venv venv; venv\Scripts\activate; python -m pip install -q --upgrade pip; python -m pip install -qr requirements.txt -
Linux & MacOs:
python3 -m venv venv; source venv/bin/activate; python -m pip install -q --upgrade pip; python -m pip install -qr requirements.txt
NB: For MacOs users, please install Xcode if you have an issue.
-
Run the demo apps (being at the repository root):
Gradio:
-
Demo
python gradio_project/basic_demo/app.py -
Salary prediction
python gradio_project/salary/app.py -
Titanic survival prediction
python gradio_project/titanic/app.py -
Go to your browser at the following address :
Streamlit:
streamlit run streamlit_project/basic_demo/app.py-
Go to your browser at the following address :
-
| Gradio Salary Prediction | Gradio Titanic Survival Prediction |
|---|---|
| Streamlit Basic Demo |
|---|
Here are some ressources you would read to have a good understanding of Gradio and Streamlit :
Feel free to make a PR or report an issue 😃.
Oh, one more thing, please do not forget to put a description when you make your PR 🙂.