i_vorobyev commited on
Commit
5a255ae
·
1 Parent(s): f96d643

add download button

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -60,8 +60,24 @@ def molecule(input_pdb):
60
  </script>
61
  </body></html>"""
62
  )
 
 
 
 
 
 
63
 
64
- return f"""<iframe style="width: 100%; height: 600px" name="result" allow="midi; geolocation; microphone; camera;
 
 
 
 
 
 
 
 
 
 
65
  display-capture; encrypted-media;" sandbox="allow-modals allow-forms
66
  allow-scripts allow-same-origin allow-popups
67
  allow-top-navigation-by-user-activation allow-downloads" allowfullscreen=""
 
60
  </script>
61
  </body></html>"""
62
  )
63
+ dw_script = """
64
+ <script type="text/javascript" >
65
+ function download(filename, text) /{
66
+ var element = document.createElement('a');
67
+ element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
68
+ element.setAttribute('download', filename);
69
 
70
+ element.style.display = 'none';
71
+ document.body.appendChild(element);
72
+
73
+ element.click();
74
+
75
+ document.body.removeChild(element);
76
+ /}
77
+ </script>
78
+ """
79
+
80
+ return dw_scriipt + f"""<iframe style="width: 100%; height: 600px" name="result" allow="midi; geolocation; microphone; camera;
81
  display-capture; encrypted-media;" sandbox="allow-modals allow-forms
82
  allow-scripts allow-same-origin allow-popups
83
  allow-top-navigation-by-user-activation allow-downloads" allowfullscreen=""