Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to connect an ml model to a web application

if __name__ == "__main__":
    app.run(debug=True)
Comment

how to connect an ml model to a web application

#import libraries
import numpy as np
from flask import Flask, render_template,request
import pickle#Initialize the flask App
app = Flask(__name__)
model = pickle.load(open('model.pkl', 'rb'))
Comment

how to connect an ml model to a web application

#default page of our web-app
@app.route('/')
def home():
    return render_template('index.html')
Comment

how to connect an ml model to a web application

#To use the predict button in our web-app
@app.route('/predict',methods=['POST'])
def predict():
    #For rendering results on HTML GUI
    int_features = [float(x) for x in request.form.values()]
    final_features = [np.array(int_features)]
    prediction = model.predict(final_features)
    output = round(prediction[0], 2) 
    return render_template('index.html', prediction_text='CO2    Emission of the vehicle is :{}'.format(output))
Comment

how to connect an ml model to a web application

# How To add ML to web. Go from down to up. Please
Comment

PREVIOUS NEXT
Code Example
Python :: read a csv and plot in python 
Python :: beautiful soup get class name 
Python :: select a range of rows in pandas dataframe 
Python :: calculate the distance between two points 
Python :: how to print a number at the end of a for loop in python 
Python :: get absolute url django 
Python :: count of datatypes in columns 
Python :: anaconda 3 geopandas 
Python :: how to count backwards in for loop python 
Python :: Python pandas first and last element of column 
Python :: python how to get user input 
Python :: openpyxl full tutorial 
Python :: formatted string python 
Python :: pandas sep 
Python :: python comment block 
Python :: dictionary size in python 
Python :: radix sort in python 
Python :: bash python csv to json 
Python :: python scheduling 
Python :: pandas make new dataframe 
Python :: ardent 
Python :: publisher python ros 
Python :: concatenate int to string python 
Python :: how to detect when a key is pressed in pygame 
Python :: python pathlib create directory if not exists 
Python :: python isnan 
Python :: change dictionary value python 
Python :: check remote port is open or not using python 
Python :: tabula python 
Python :: WebDriverWait 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =