Download the dataframe returned by the model in the app

I want to set a download button which downloads the dataframe in the form of csv returned by the ml model.So when it gets deployed,user can download the data from the webbrowser and makes use of it.

The current solution for providing a file download to a user is explained in this thread:

Can user download the data using this code?

Yes, when you set up the link in this manner, you are providing the file bytes in the link. When the user clicks on this, the file will download as myfilename.csv