Download button to save Facebook Prophet models (json.dump) not working

Hi guys,

I’m trying to create a download button save Facebook Prophet models, a forecasting utility.

FYI, here’s the code to do a save in memory:

import json
from fbprophet.serialize import model_to_json, model_from_json

# Save model in memory

with open('serialized_model.json', 'w') as fout:
    json.dump(model_to_json(m), fout)  

Currently, the model is being saved in memory yet I can’t seem to download it via a download button/link…

Any help appreciated! :slight_smile: :raised_hands:

If need be, here’s more info on FB’s website:

Thanks,
Charly

This should help:

I fixed it via the download_button function in the file attached. Courtesy of @jrieke! :pray:

Charly

1 Like