def get_location_names(): response = jsonify({ 'locations': util.get_location_names() }) response.headers.add('Access-Control-Allow-Origin', '*') print(util.get_location_names()) sys.stdout.flush() return response
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)
def get_location_names(): response = jsonify({"locations": util.get_location_names()}) # allow request from any origin of flask endpoint response.headers.add("Access-Control-Allow-Origin", "*") return response
def get_location_names(): response = jsonify({ 'locations': util.get_location_names() #get location from the util file }) response.headers.add('Access-Control-Allow-Origin', '*') return response #returning the locations which contains all the locations
def get_location_names(): response = jsonify({'locations': util.get_location_names()}) response.headers.add( 'Access-Control-Allow-Origin', '*' ) # this make the API vulnerable to cross-site request forgery(CSRF) return response
def get_location_names(): response = jsonify({ 'locations': util.get_location_names() }) response.headers.add('Access-Control-Allow-Origin', '*') return response
def get_location_names(): response = jsonify({ "locations": util.get_location_names() }) # returning response w all locations response.headers.add("Access-Control-Allow-Origin", "*") return response
def get_all_data(): response = jsonify({ 'location': util.get_location_names(), 'bhk': util.get_bhk(), 'bath': util.get_bath(), }) response.headers.add('Access-Control-Allow-Origin', '*') return response
def get_location_names(): ''' This function when called will create a response The response is to return all the location in bangalore city ''' response = jsonify({'locations': util.get_location_names()}) 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']) print(location, bhk, bath) print("location", util.get_location_names()) response = jsonify({ 'estimated_price': util.get_estimated_price(location, total_sqft, bhk, bath) }) response.headers.add('Access-Control-Allow-Origin', '*') return response
def get_location_names(): response = util.get_location_names() return response
def get_location_names_final(): response = jsonify({ "locations": get_location_names() }) response.headers.add('Access-Control-Allow-Origin', '*') return response
def get_location_names(): response = jsonify({'locations': util.get_location_names()}) response.headers.add("Access Control", '*') return response
def get_locations() : response = jsonify({ 'locations' : util.get_location_names() }) return response
def get_location_names(): response = jsonify({'locations': util.get_location_names()}) #response.headers.add('Access-Control-Allow-Origin','*'); #Use above line in case of CORR error. return response
def hello(): response = jsonify({"locations": util.get_location_names()}) response.headers.add("Acces-Control-Allow-Origin", "*") return response
def get_location_names(): response = jsonify({'locations': util.get_location_names()}) # response.headers.add('Access-Control-Allow-Origin', '*') # return response return render_template('index.html')
def get_location_names( ): # first routine created is get_location_name using jsonify (serialize data) response = jsonify({'locations': util.get_location_names()}) response.headers.add('Access-Control-Allow-Origin', '*') return response
def Home(): locations = util.get_location_names() return render_template('index.html', locationss=locations)
response = jsonify({'locations': util.get_location_names()}) response.headers.add('Access-Control-Allow-Origin', '*') return response @app.route("/hello") def hello(): return 'hello' @app.route('/get_price', methods=['POST']) def get_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', '*') response.status_code = 200 return response if __name__ == "__main__": print('Starting Python Flask Server for Home Price Prediction.....') util.load_saved_artifacts() print(util.get_location_names()) app.run()