Spaces:
No application file
No application file
from flask import Flask, request, jsonify | |
import util | |
app = Flask(__name__) | |
def get_location_names(): | |
locations = util.get_location_names() | |
print(f"Locations fetched: {locations}") | |
response = jsonify({ | |
'locations': locations | |
}) | |
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']) | |
estimated_price = util.get_estimated_price(location, total_sqft, bhk, bath) | |
print(f"Estimated price calculated: {estimated_price}") | |
response = jsonify({ | |
'estimated_price': estimated_price | |
}) | |
response.headers.add('Access-Control-Allow-Origin', '*') | |
return response | |
if __name__ == "__main__": | |
print("Starting...") | |
util.load_saved_artifacts() | |
app.run() |