Spaces:
Sleeping
Sleeping
| from flask import Flask, request, render_template | |
| import pickle | |
| import joblib | |
| import numpy | |
| app = Flask("Modelo Acciones") | |
| def main(): | |
| # If a form is submitted | |
| if request.method == "POST": | |
| model = joblib.load("modelo_acciones.pkl") | |
| # Get values through input bars | |
| dias = int(request.form.get("dias")) | |
| try: | |
| dias = int(dias) | |
| except: | |
| dias = 1 | |
| output = model.forecast(dias) | |
| prediction = [] | |
| i=0 | |
| for result in output: | |
| i+=1 | |
| prediction.append("Precio de cierre dia " + str(i) +": US$" + str(result)) | |
| else: | |
| prediction = "" | |
| return render_template("website.html", outputs = prediction) | |
| # Running the app | |
| if __name__ == '__main__': | |
| app.run(debug = True) |