Пример #1
0
def predict_used_car():
    manufacturers = request.form['manufacturers']
    models = request.form['models']
    transmission = request.form['transmission']
    color = request.form['color']
    engine_fuel = request.form['engine_fuel']
    engine_type = request.form['engine_type']
    body = request.form['body']
    state = request.form['state']
    drivetrain = request.form['drivetrain']
    odometer_value = int(request.form['odometer_value'])
    year_produced = int(request.form['year_produced'])
    engine_has_gas = int(request.form['engine_has_gas'])
    engine_capacity = float(request.form['engine_capacity'])
    has_warranty = int(request.form['has_warranty'])
    is_exchangeable = int(request.form['is_exchangeable'])
    number_of_photos = float(request.form['number_of_photos'])
    up_counter = int(request.form['up_counter'])
    duration_listed = int(request.form['duration_listed'])

    response = jsonify({
        'estimated_price':
        util.get_estimated_price(manufacturers, models, transmission, color,
                                 engine_fuel, engine_type, body, state,
                                 drivetrain, odometer_value, year_produced,
                                 engine_has_gas, engine_capacity, has_warranty,
                                 is_exchangeable, number_of_photos, up_counter,
                                 duration_listed)
    })
    response.headers.add('Access-Control-Allow-Origin', '*')

    return response
Пример #2
0
def main_streamlit():
    st.title("Price Prediction")
    ##st.write("Hello World Streamlit")
    html_temp = """
    <div style="background-color:tomato;padding:10px">
    <h2 style="color:white;text-align:center;">Streamlit Housing Price Prediction ML App </h2>
    </div>
    """
    st.markdown(html_temp, unsafe_allow_html=True)

    total_sqft = st.slider("total_sqft",
                           min_value=500.0,
                           max_value=5000.0,
                           step=10.0)
    st.write("Total Square Ft.", total_sqft)
    #location = st.text_input("location","Type Here")
    location = st.selectbox("Select the location", util.get_location_names())
    st.write('You selected', location)
    bhk = st.slider("bhk", min_value=1, max_value=10, step=1)
    st.write("Total BHK", bhk)
    bath = st.slider("bath", min_value=1, max_value=10, step=1)
    st.write("Total Bath", bath)
    estimated_price = ""
    if st.button("Predict"):
        estimated_price = util.get_estimated_price(location, total_sqft, bhk,
                                                   bath)
        print(estimated_price)
        st.write('The predicted price is ', estimated_price)
Пример #3
0
def predict_home_price(location, total_sqft, bhk, bath):
    total_sqft = float(total_sqft)
    location = location
    bhk = int(bhk)
    bath = int(bath)
    estimated_price = util.get_estimated_price(location, total_sqft, bhk, bath)
    return float(estimated_price)
Пример #4
0
def predict_home_price():
    total_sqft = float(request.form['squareft'])
    location = request.form['location']
    bhk = int(request.form['bhk'])
    bath = int(request.form['bath'])
    #return 'total sqft : '+str(total_sqft)+'Location : '+str(location)+'BHK : '+str(bhk)+'bath : '+str(bath)

    return str(util.get_estimated_price(location, total_sqft, bhk, bath)[0])
Пример #5
0
def predict_home_price():
    rooms = request.form['rooms']
    location = request.form['suburb']

    response = jsonify(
        {'estimated_price': util.get_estimated_price(rooms, location)})
    response.headers.add('Access-Control-Allow-Origin', '*')

    return response
def predict_prce():
    total_sqft = float(request.form['total_sqft'])
    location = request.form['location']
    bhk = int(request.form['bhk'])
    bath = int(request.form['bath'])

    response = jsonify({'estimated_price': util.get_estimated_price(location, bhk, bath, total_sqft)})
    response.headers.add('Access-Control-Allow-Origin', '*')
    return response
Пример #7
0
def predict_home_price():
    area = float(request.form['area'])
    location = request.form['location']
    bhk = int(request.form['bhk'])
    util.load_saved_artifacts()
    response = jsonify(
        {'estimated_price': util.get_estimated_price(location, area, bhk)})
    response.headers.add('Access-Control-Allow-Origin', '*')

    return response
Пример #8
0
def predict_home_price():
    sqft=float(request.form['sqft'])
    baths = float(request.form['baths'])
    beds = float(request.form['beds'])


    response=jsonify({'estimated_price': util.get_estimated_price(sqft,baths,beds)})

    response.headers.add('Access-Control-Allow-Origin', '*')
    return response
Пример #9
0
def predict_home_price():
    location = request.form['location']
    no_of_rooms = request.form['noOfRooms']

    response = jsonify(
        {'estimated_price': util.get_estimated_price(location, no_of_rooms)})

    response.headers.add('Access-Control-Allow-Origin', '*')

    return response
Пример #10
0
def predict_home_price():
    sqft = request.form['sqftarea']
    location = request.form['location']
    bhk = request.form['BHK']
    bath = request.form['Bath']
    # response = jsonify({'estimated price':util.get_estimated_price(location,sqft,bhk,bath)})
    # response.headers.add('Access-Control-Allow-Origin', '*')
    # return response
    response = util.get_estimated_price(location, sqft, bhk, bath)
    return render_template(
        'index.html', prediction_text='    Price is {} lakh.'.format(response))
Пример #11
0
def predict_home_price():
    sqft = int(request.form['sqft'])
    bath = float(request.form['bath'])
    bhk = float(request.form['bhk'])
    rank = int(request.form['rank'])

    response = jsonify(
        {'estimated_price': util.get_estimated_price(sqft, bath, bhk, rank)})
    response.headers.add('Access-Control-Allow-Origin', '*')

    return response
Пример #12
0
def predict_kero_price():
    # create a form
    year = int(request.form['year'])
    month = request.form['month']

    response = jsonify(
        {'estimated_price': util.get_estimated_price(month, year)})

    response.headers.add("Access-Control-Allow-Origin", "*")

    return response
def predict_home_price():
    total_sqft = float(request.form['total_sqft'])
    location = request.form['location']
    bhk = int(request.form['bhk'])
    bath = int(request.form['bath'])

    response = jsonify({
        'estimated_price':
        util.get_estimated_price(location, total_sqft, bhk, bath)
    })
    return response
Пример #14
0
def predict_modalprice():
    market = request.form['market']
    min_price = float(request.form['min_price'])
    max_price = float(request.form['max_price'])

    response = jsonify({
        'estimated_price':
        util.get_estimated_price(market, min_price, max_price)
    })
    response.headers.add('Access-Control-Allow-Origin', '*')

    return response
Пример #15
0
def predict_home_price():
    total_sqft = float(request.form["total_sqft"])
    location = request.form["location"]
    bhk = int(request.form["bhk"])
    bath = int(request.form["bath"])

    response = jsonify({
        "estimated_price":
        util.get_estimated_price(location, total_sqft, bhk, bath)
    })

    response.headers.add("Access-Control-Allow-Origin", "*")
    return response
Пример #16
0
def predict_home_price():
    total_sqft = float(request.form['total_sqft'])
    location = request.form['location']
    bhk = int(request.form['bhk'])
    bath = int(request.form['bath'])

    response = jsonify({
        'estimated_price':
        util.get_estimated_price(location, total_sqft, bhk, bath)
    })
    #response.headers.add('Access-Control-Allow-Origin','*');
    #Use above line in case of CORR error.
    return response
Пример #17
0
def predict_home_price():
    if request.method == 'POST':
        total_sqft = float(request.form['sqft'])
        bhk = int(request.form['bhk'])
        bath = int(request.form['bath'])
        location = request.form.get('loc')
        prediction = util.get_estimated_price(location, total_sqft, bhk, bath)

        return render_template(
            'home.html',
            prediction_text="The Predicted house price is Rs. {} lakhs".format(
                prediction))
    return render_template("home.html")
Пример #18
0
def predict_home_price():
    total_sqft = float(request.form['distance'])
    location = request.form['Suburb']
    bhk = int(request.form['rooms'])
    # bath = int(request.form['bath'])

    response = jsonify({
        'estimated_price':
        util.get_estimated_price(location, total_sqft, bhk)
    })
    response.headers.add('Access-Control-Allow-Origin', '*')

    return response
Пример #19
0
def predict_home_price():
    newBuilding = int(request.form['newBuilding'])
    floorNumber = int(request.form['floorNumber'])
    fromDeveloper = int(request.form['fromDeveloper'])
    isApartments = int(request.form['isApartments'])
    isAuction = int(request.form['isAuction'])
    kitchenArea = int(request.form['kitchenArea'])
    livingArea = int(request.form['livingArea'])
    roomsCount = int(request.form['roomsCount'])
    totalArea = int(request.form['totalArea'])
    floorsCount = int(request.form['floorsCount'])
    isComplete = int(request.form['isComplete'])
    passengerLiftsCount = int(request.form['passengerLiftsCount'])
    cargoLiftsCount = int(request.form['cargoLiftsCount'])
    hasBalcony = int(request.form['hasBalcony'])
    isBasement = int(request.form['isBasement'])
    isFirstFloor = int(request.form['isFirstFloor'])
    isLastFloor = int(request.form['isLastFloor'])
    flatType = request.form['flatType']
    region = request.form['region']
    city = request.form['city']
    materialType = request.form['materialType']

    response = jsonify({
        'estimated_price': util.get_estimated_price(
            newBuilding,
            floorNumber,
            fromDeveloper,
            isApartments,
            isAuction,
            kitchenArea,
            livingArea,
            roomsCount,
            totalArea,
            floorsCount,
            isComplete,
            passengerLiftsCount,
            cargoLiftsCount,
            hasBalcony,
            isBasement,
            isFirstFloor,
            isLastFloor, 
            flatType,
            region,
            city,
            materialType
            )
    })
    response.headers.add('Access-Control-Allow-Origin', '*')

    return response
Пример #20
0
def bhppredict():
    area = request.args.get('area')
    bhk = request.args.get('bhk')
    bath = request.args.get('bath')
    loc = request.args.get('loc')

    price = float(util.get_estimated_price(loc, area, bhk, bath))

    return render_template('bhppredict.html',
                           area=area,
                           bhk=bhk,
                           bath=bath,
                           loc=loc,
                           price=price)
def get_estimated_price():
    sqft = float(request.form['sqft'])
    location = request.form['location']
    n_rooms = request.form['n_rooms']
    n_bedrooms = request.form['n_bedrooms']
    n_bathrooms = request.form['n_bathrooms']

    response = jsonify({
        'estimated_price':
        util.get_estimated_price(location, sqft, n_rooms, n_bedrooms,
                                 n_bathrooms)
    })
    response.headers.add('Access-Control-Allow-Origin', '*')
    return response
Пример #22
0
def predict_home_price():

    data = request.get_json()
    total_sqft = float(data['total_sqft'])
    location = data['location']
    bhk = int(data['bhk'])
    bath = int(data['bath'])
    response = jsonify({
        'estimated_price':
        util.get_estimated_price(location, total_sqft, bhk, bath)
    })
    response.headers.add('Access-Control-Allow-Origin', '*')

    return response
Пример #23
0
def predict_home_price():
    total_sqft = float(
        request.form['total_sqft'])  #getting all inputs in request.form
    location = request.form['location']
    bhk = int(request.form['bhk'])
    bath = int(request.form['bath'])

    response = jsonify({  #response
        'estimated_price':
        util.get_estimated_price(location, total_sqft, bhk, bath)
    })

    response.headers.add('Access-Control-Allow-Origin', '*')
    return response
Пример #24
0
def predict_home_price():
    # implementing a dummy routine. can get the form input from request.form
    total_sqft = float(request.form['total_sqft'])
    location = request.form['location']
    bhk = int(request.form['bhk'])
    bath = int(request.form['bath'])

    response = jsonify({
        "estimated_price": util.get_estimated_price(location, total_sqft, bhk, bath)
    })

    response.headers.add("Access-Control-Allow-Origin", "*")

    return response
def predict_home_price():
    total_sqft = float(request.form['total_sqft'])
    location = request.form['location']
    bhk = int(request.form['bhk'])
    bath = int(request.form['bath'])

   # response = jsonify({
   #     'estimated_price': get_estimated_price(location,total_sqft,bhk,bath)
   # })
   # response.headers.add('Access-Control-Allow-Origin', '*')
    estimated_price = get_estimated_price(location,total_sqft,bhk,bath)
    estimated_price = str(round(estimated_price,4)) + " Lakhs"

    return render_template('index.html', response= estimated_price)
Пример #26
0
def predict_home_price():
    total_sqft = float(request.form['total_sqft'])
    location = request.form['location']
    bedroom = int(request.form['bedroom'])
    bath = int(request.form['bath'])
    print(total_sqft)

    response = jsonify({
        'estimated_price':
        util.get_estimated_price(location, total_sqft, bedroom, bath)
    })

    response.headers.add('Access-Control-Allow-Origin', '*')

    return response
Пример #27
0
def predict_home_price():
    total_sqft = float(str(request.form["total_sqft"]))
    location = str(request.form['location'])
    bath = int(request.form['bath'])
    balcony = int(str(request.form['balcony']))
    bhk = int(str(request.form['bhk']))

    response = jsonify({
        'estimated_price':
        util.get_estimated_price(location, total_sqft, bath, balcony, bhk)
    })

    response.headers.add('Access-Control-Allow-Origin', '*')

    return response
Пример #28
0
def predict_house_price():
    '''
    This function calls the get_estimated_price function from util.py
    '''
    total_sqft = float(request.form['total_sqft'])
    location = request.form['location']
    bhk = int(request.form['bhk'])
    bath = int(request.form['bath'])

    response = jsonify({
        'estimated_price':
        util.get_estimated_price(location, total_sqft, bhk, bath)
    })
    response.headers.add('Access-control-Allow-Origin', '*')
    return response
Пример #29
0
def predict_home_price():
    total_m2 = float(request.form['m2'])
    location = request.form['location']
    room_f = int(request.form['room_f'])
    room_hf = int(request.form['room_hf'])
    butor = request.form['butor']
    emelet = request.form['emelet']
    lift = request.form['lift']
    # kerület, m2, szoba, félszoba, bútorozott, emelet, lift
    response = jsonify({
        'estimated_price': util.get_estimated_price(location, total_m2, room_f, room_hf, butor, emelet, lift)
    })
    response.headers.add('Access-Control-Allow-Origin', '*')

    return response
Пример #30
0
def predict_home_price():
    try:
        bedrooms = int(request.args.get('bedrooms'))
        bathrooms = int(request.args.get('bathrooms'))
        square_footage = int(request.args.get('square_footage'))
        resident_type = request.args.get('resident_type')
        response = jsonify({
            'estimated_price':
            util.get_estimated_price(resident_type, bedrooms, bathrooms,
                                     square_footage)
        })
        response.headers.add('Access-Control-Allow-Origin', '*')
        return response
    except:
        return jsonify({"message": "Error occurred"})