I m currently deploy a machine learning model in web using flask python, Does anyone know how to return my response.headers["Content-Disposition"] = "attachment; filename=result.csv" and plot graph together? Currently I only can return my plot graph but no idea how to return or get the response with new CSV file
new_data = pd.DataFrame(dicts).set_index("Month")
response = make_response(new_data.to_csv(index = True, encoding='utf8'))
response.headers["Content-Disposition"] = "attachment; filename=result.csv" #Want to return this response to auto download a new CSV file also
labels = [d['Month'] for d in dicts]
values = [d['Predictions'] for d in dicts]
colors = [ "#F7464A", "#46BFBD", "#FDB45C", "#FEDCBA",
"#ABCDEF", "#DDDDDD", "#ABCABC", "#4169E1",
"#C71585", "#FF4500", "#FEDCBA", "#46BFBD"]
line_labels=labels
line_values=values
return render_template('graph.html', title='Time Series Sales forecasting', max=17000,
labels=line_labels, values=line_values)
Aucun commentaire:
Enregistrer un commentaire