Tuesday, April 13, 2021
  • Setup menu at Appearance » Menus and assign menu to Top Bar Navigation
Advertisement
  • AI Development
    • Artificial Intelligence
    • Machine Learning
    • Neural Networks
    • Learn to Code
  • Data
    • Blockchain
    • Big Data
    • Data Science
  • IT Security
    • Internet Privacy
    • Internet Security
  • Marketing
    • Digital Marketing
    • Marketing Technology
  • Technology Companies
  • Crypto News
No Result
View All Result
NikolaNews
  • AI Development
    • Artificial Intelligence
    • Machine Learning
    • Neural Networks
    • Learn to Code
  • Data
    • Blockchain
    • Big Data
    • Data Science
  • IT Security
    • Internet Privacy
    • Internet Security
  • Marketing
    • Digital Marketing
    • Marketing Technology
  • Technology Companies
  • Crypto News
No Result
View All Result
NikolaNews
No Result
View All Result
Home Neural Networks

How to Deploy AI models? Part 6- Deploying Web-application on Streamlit via Github | by RAVI SHEKHAR TIWARI | Mar, 2021

April 6, 2021
in Neural Networks
How to Deploy AI models? Part 6- Deploying Web-application on Streamlit via Github | by RAVI SHEKHAR TIWARI | Mar, 2021
585
SHARES
3.2k
VIEWS
Share on FacebookShare on Twitter

This Part is the continuation of the Deploying AI models , where we deployed Iris classification model using Decision Tree Classifier, had a glance of version control i.e. Git. In this article, we will see how we can deploy data science as well as Machine Learning application easily with the help of open source library streamlit.

1.1. Packages

The following packages were used to create the application.

You might also like

BERT Transformers — How Do They Work? | by James Montantes | Apr, 2021

Learning Not To Fear Machine Learning | by Dimitry Belozersky | Apr, 2021

WOMEN IN A.I. ~ Future is Female

1.1.1. Numpy, pandas

1.1 .2. Streamlit

  1. 1.3. Dataset, SVC, Model Selection from sklearn
Big Data Jobs

1.2. Dataset

The dataset is used to train the model is of digit dataset composed of 10 classes i.e. label is 10 from 0–9 with 180 samples per class where each sample is represented as a vector with dimension of vector of length 64 thought it can be reshaped into 8*8 vector to represent the dataset into 1-D image

Predictors: Pixel value in form of vector with length 64, where each piel value ranges between 0–16

Target : Digit labelled from 0–10

Dataset Shape: 1797 * 65 metrics

Figure 1. Dataset Overview

1.3. Model

For training the model we followed the following procedure:

Data Split up: 8:2 i.e. 80% training set and 20% for the test set

Model: Support Vector Machine Classifier

Below is the code for the training the model.

import sklearnimport 
sklearn.datasetsimport sklearn.ensemble
import sklearn.model_selection
from sklearn import svm, metrics
import pickle
import os
#load datadata = data=sklearn.datasets.load_digits() #Split the data into test andtraintrain_data, test_data, train_labels, test_labels = sklearn.model_selection.train_test_split(data.data, data.target, train_size=0.80)print(train_data,train_labels)#Train a model using random
model = svm.SVC(kernel=parameters['kernal'],tol=float(parameters['Tol']),max_iter=int(parameters['Max_Iteration'])).fit(X_train,y_train)
#test the model
result = model.score(test_data, test_labels)
print(result)
#save the model
filename = ‘iris_model.pkl’
pickle.dump(model, open(filename, ‘wb’))

1.4. Frontend using Streamlit

For feeding the value in the trained model we need some User Interface to accept the data from the user and feed into the trained neural network for classification. As we have seen in the section in 1.2 Dataset where we have 64 vectors for each samples with 10 classes .

1. Why Corporate AI projects fail?

2. How AI Will Power the Next Wave of Healthcare Innovation?

3. Machine Learning by Using Regression Model

4. Top Data Science Platforms in 2021 Other than Kaggle

We will use streamlit API to create the frontend and for displaying the various frontend part of this application. Instead of creating the separate the html files for the front end file streamlit API gives us the flexibility to write the code in the same script which is shown below (as refrence):

import streamlit as st
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import sklearn.datasets
from sklearn.model_selection import train_test_split
col1, col2= st.beta_columns(2)
with col1:
st.write("**Profile :** https://www.rstiwari.com")
with col2:
st.write("**Blog :** https://tiwari11-rst.medium.com/")
# Text/Titlest.title("Logistic Regression - Mnist Dataset") }

Similarly you can create the various frontend elements for reference please refer to the Link. This article does not covers the concept of how to use streamlit for developing the model — It covers how we can deploy the model on streamlit.

1.5. Extracting Packages and their respective versions

We need to create the require.txt file which contains the name of package we used in our application along with their respective version. The process of extracting the requirement.txt file is explained in the Article: Deep Learning/Machine Learning Libraries — An overview.

For this application below is the requirement.txt file content.

streamlit==0.76.0 
joblib==1.0.0
numpy==1.19.3
scikit-learn==0.23.2
scipy==1.5.4
sklearn==0.0

2. Streamlit

Streamlit is gaining popularity in Machine learning and Data Science. It is a very easy library to create a perfect dashboard by spending a little amount of time. It also comes with the inbuilt webserver and lets you deploy in the docker container.

Step 1:

Open the Link and do the following:

Click on the New app and select Deploy from existing repo option as shown in below image.

Fig 2. Deploying the branch

Step 2:

Select the Repository

The branch of the repository where the files are present main or master and the name of the script file as shown in below image:

Fig 3. Deployement Procedure
Fig 4. Application is being deployed

Congratulation!!! we have successfully deployed an Iris classifier web application.

4. Deployed Web Application

The overview of the deployed web application with Iris Application: Link is shown below.

Fig 5. Deployed Application Digit Classification

We have reached to an end to the model deployment series, hope you al have gained something from this series. Please visit this link to get list of all deployed application.

As we say “Car is useless if it doesn’t have a good engine” similarly student is useless without proper guidance and motivation. I will like to thank my Guru as well as my Idol “Dr. P. Supraja”- guided me throughout the journey, from the bottom of my heart. As a Guru, she has lighted the best available path for me, motivated me whenever I encountered failure or roadblock- without her support and motivation this was an impossible task for me.

Extract installed packages and version : Article Link.

Notebook Link Extract installed packages and version : Notebook Link

How to Deploy AI Models? — Part 1 : Link

How to Deploy AI Models? — Part 2 Setting up the Github For Herolu and Streamlit : Link

Streamlit Docs : Link

Streamlit Login : Link

YouTube : Link

Deployed Application: Link

Iris Application: Link

If you have any query feel free to contact me with any of the -below mentioned options:

Website: www.rstiwari.com

Medium: https://tiwari11-rst.medium.com

Google Form: https://forms.gle/mhDYQKQJKtAKP78V7

Credit: BecomingHuman By: RAVI SHEKHAR TIWARI

Previous Post

Most agency professionals don’t believe their company is evolving: Monday's daily brief

Next Post

Why Business Executives Should Be Hip To ML Tools

Related Posts

BERT Transformers — How Do They Work? | by James Montantes | Apr, 2021
Neural Networks

BERT Transformers — How Do They Work? | by James Montantes | Apr, 2021

April 13, 2021
Learning Not To Fear Machine Learning | by Dimitry Belozersky | Apr, 2021
Neural Networks

Learning Not To Fear Machine Learning | by Dimitry Belozersky | Apr, 2021

April 13, 2021
WOMEN IN A.I. ~ Future is Female
Neural Networks

WOMEN IN A.I. ~ Future is Female

April 12, 2021
A Primer of 29 Interactions for AI
Neural Networks

A Primer of 29 Interactions for AI

April 10, 2021
Univariate Linear Regression: Explained with Examples | by WeiQin Chuah | Apr, 2021
Neural Networks

Univariate Linear Regression: Explained with Examples | by WeiQin Chuah | Apr, 2021

April 10, 2021
Next Post
Why Business Executives Should Be Hip To ML Tools

Why Business Executives Should Be Hip To ML Tools

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended

Plasticity in Deep Learning: Dynamic Adaptations for AI Self-Driving Cars

Plasticity in Deep Learning: Dynamic Adaptations for AI Self-Driving Cars

January 6, 2019
Microsoft, Google Use Artificial Intelligence to Fight Hackers

Microsoft, Google Use Artificial Intelligence to Fight Hackers

January 6, 2019

Categories

  • Artificial Intelligence
  • Big Data
  • Blockchain
  • Crypto News
  • Data Science
  • Digital Marketing
  • Internet Privacy
  • Internet Security
  • Learn to Code
  • Machine Learning
  • Marketing Technology
  • Neural Networks
  • Technology Companies

Don't miss it

A.I. For Raspberry Pi Pico: Uctronics TinyML Learning Kit Review
Machine Learning

A.I. For Raspberry Pi Pico: Uctronics TinyML Learning Kit Review

April 13, 2021
BERT Transformers — How Do They Work? | by James Montantes | Apr, 2021
Neural Networks

BERT Transformers — How Do They Work? | by James Montantes | Apr, 2021

April 13, 2021
Bug bounties: More hackers are spotting vulnerabilities across web, mobile and IoT
Internet Security

Critical security alert: If you haven’t patched this old VPN vulnerability, assume your network is compromised

April 13, 2021
Epoch and Map of the Energy Transition through the Consensus Validator
Data Science

Epoch and Map of the Energy Transition through the Consensus Validator

April 13, 2021
Bitcoin mining in China could threaten climate policies, new study shows
Blockchain

Bitcoin mining in China could threaten climate policies, new study shows

April 13, 2021
Artificial Intelligence Research at Duke
Machine Learning

Artificial Intelligence Research at Duke

April 13, 2021
NikolaNews

NikolaNews.com is an online News Portal which aims to share news about blockchain, AI, Big Data, and Data Privacy and more!

What’s New Here?

  • A.I. For Raspberry Pi Pico: Uctronics TinyML Learning Kit Review April 13, 2021
  • BERT Transformers — How Do They Work? | by James Montantes | Apr, 2021 April 13, 2021
  • Critical security alert: If you haven’t patched this old VPN vulnerability, assume your network is compromised April 13, 2021
  • Epoch and Map of the Energy Transition through the Consensus Validator April 13, 2021

Subscribe to get more!

© 2019 NikolaNews.com - Global Tech Updates

No Result
View All Result
  • AI Development
    • Artificial Intelligence
    • Machine Learning
    • Neural Networks
    • Learn to Code
  • Data
    • Blockchain
    • Big Data
    • Data Science
  • IT Security
    • Internet Privacy
    • Internet Security
  • Marketing
    • Digital Marketing
    • Marketing Technology
  • Technology Companies
  • Crypto News

© 2019 NikolaNews.com - Global Tech Updates