how to make download link in Jupyter appmode
from ipywidgets import HTML
from IPython.display import display
import base64
res = 'computed results'
#FILE
filename = 'res.txt'
b64 = base64.b64encode(res.encode())
payload = b64.decode()
#BUTTONS
html_buttons = '''<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<a download="{filename}" href="data:text/csv;base64,{payload}" download>
<button class="p-Widget jupyter-widgets jupyter-button widget-button mod-warning">Download File</button>
</a>
</body>
</html>
'''
html_button = html_buttons.format(payload=payload,filename=filename)
display(HTML(html_button))