Skip to content

Instantly share code, notes, and snippets.

View analyticsindiamagazine's full-sized avatar
:octocat:

Analytics India Magazine analyticsindiamagazine

:octocat:
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@analyticsindiamagazine
analyticsindiamagazine / Feature_Pipeline.py
Created January 13, 2020 07:57
Template for Feature_Pipeline.py
# -*- coding: utf-8 -*-
""" This is the expected File Format for Feature_pipeline.py script """
## import required libraries
import time
import pandas as pd
import os
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#Importing the speech recognition module
import speech_recognition as sr
#A random default value for prediction -- not among the classes we are predicting
prediction = 10
#Initializing the speech recognizer
r = sr.Recognizer()
#Declaring the listener source
with sr.Microphone() as source:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def predict():
try:
#all the input labels . We had only trained the model using these selected features.
labels = ['Brand', 'Location', 'Year', 'Kilometers_Driven', 'Fuel_Type','Transmission', 'Owner_Type', 'Mileage']
#Collecting values from the html form and converting into respective types as expected by the model
Brand = request.form["Brand"]
Location = request.form["Location"]
Year = int(request.form["Year"])
#Importing necessary packages
import numpy as np
from flask import Flask, request, render_template
import pickle
from fastai.tabular import *
import os