Commit db6c091b authored by Deshini Perera's avatar Deshini Perera

Add new file

parent 9e9dd2c9
from flask import Flask, request, url_for, redirect, render_template
from flask_cors import CORS
import json
import LSTM.predictor as pr
import os
app = Flask(__name__)
CORS(app)
@app.route('/forecasting', methods=['GET', 'POST'])
def forecasting():
no_of_months = int(request.form['no_of_months'])
result = pr.getData(no_of_months)
output_value = []
for x in range(len(result)):
output_value.append(round(result[x]['value'], 1))
return_str = '{ "Your requested prediction is " : ' + str(output_value[0]) + ' }'
return json.loads(return_str)
if __name__ == '__main__':
app.run(host="0.0.0.0", port=5000, debug=True)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment