def makeVis(zipCode): output = showCuisines(loadData(), zipCode).to_json() return Response(output, mimetype='application/json', headers={ 'Cache-Control': 'no-cache', 'Access-Control-Allow-Origin': '*' })
def analyze(data_dir='./out/'): """Analyzes the data stored in the given directory. Keyword Arguments: data_dir {str} -- Path to the directory containing data files. (default: {'./out/'}) """ data = analysis.loadData(data_dir) # for run in data: # analysis.showMultiCDF(run[1]) analysis.showTotalCDF(data) analysis.reportDisconsensed(data)
from flask import Flask, Response from analysis import loadData, showRatingDistribution df = loadData() app = Flask(__name__, static_url_path='', static_folder='.') app.add_url_rule('/', 'root', lambda: app.send_static_file('index.html')) @app.route('/vis/<zipcode>') def hello(zipcode): print("success!") response = '' if df is not None: response = showRatingDistribution(df, zipcode).to_json() return Response(response, mimetype='application/json', headers={ 'Cache-Control': 'no-cache', 'Access-Control-Allow-Origin': '*' }) if __name__ == '__main__': app.run(port=8000)
from flask import Flask, Response from analysis import loadData, showRatingDistribution data = loadData() app = Flask(__name__, static_url_path='', static_folder='.') app.add_url_rule('/', 'root', lambda: app.send_static_file('index.html')) @app.route("/vis/<platform>") def hello(platform): df = data.get(platform, None) response = '' # return "Got the platform type '{}', and rating '{}'.".format(platform,rating) if df is not None: response = showRatingDistribution(df[['name', 'rating']], platform).to_json() return Response(response, mimetype='application/json', headers={ 'Cache-Control': 'no-cache', 'Access-Control-Allow-Origin': '*' }) if __name__ == '__main__': app.run(port=8000)