i_vorobyev
commited on
Commit
·
3363489
1
Parent(s):
0a9c6bb
add download button
Browse files
app.py
CHANGED
@@ -36,7 +36,26 @@ def molecule(input_pdb):
|
|
36 |
</style>
|
37 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.3/jquery.min.js" integrity="sha512-STof4xm1wgkfm7heWqFJVn58Hm3EtS31XFaagaa8VMReCXAkQnJZ+jEy8PCC/iT18dFy95WcExNHFTqLyp72eQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
38 |
<script src="https://3Dmol.csb.pitt.edu/build/3Dmol-min.js"></script>
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
</head>
|
41 |
<body>
|
42 |
<div id="container" class="mol-container"></div>
|
@@ -60,28 +79,6 @@ def molecule(input_pdb):
|
|
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 |
-
|
78 |
-
document.getElementById("dwn-btn").addEventListener("click", function(){
|
79 |
-
var filename = "result.pdb";
|
80 |
-
|
81 |
-
download(filename, "test";
|
82 |
-
}, false);
|
83 |
-
</script>
|
84 |
-
"""
|
85 |
|
86 |
return dw_script + f"""<iframe style="width: 100%; height: 600px" name="result" allow="midi; geolocation; microphone; camera;
|
87 |
display-capture; encrypted-media;" sandbox="allow-modals allow-forms
|
|
|
36 |
</style>
|
37 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.3/jquery.min.js" integrity="sha512-STof4xm1wgkfm7heWqFJVn58Hm3EtS31XFaagaa8VMReCXAkQnJZ+jEy8PCC/iT18dFy95WcExNHFTqLyp72eQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
38 |
<script src="https://3Dmol.csb.pitt.edu/build/3Dmol-min.js"></script>
|
39 |
+
<script type="text/javascript" >
|
40 |
+
function download(filename, text) {
|
41 |
+
var element = document.createElement('a');
|
42 |
+
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
|
43 |
+
element.setAttribute('download', filename);
|
44 |
+
|
45 |
+
element.style.display = 'none';
|
46 |
+
document.body.appendChild(element);
|
47 |
+
|
48 |
+
element.click();
|
49 |
+
|
50 |
+
document.body.removeChild(element);
|
51 |
+
}
|
52 |
+
|
53 |
+
document.getElementById("dwn-btn").addEventListener("click", function(){
|
54 |
+
var filename = "result.pdb";
|
55 |
+
|
56 |
+
download(filename, "test";
|
57 |
+
}, false);
|
58 |
+
</script>
|
59 |
</head>
|
60 |
<body>
|
61 |
<div id="container" class="mol-container"></div>
|
|
|
79 |
</script>
|
80 |
</body></html>"""
|
81 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
return dw_script + f"""<iframe style="width: 100%; height: 600px" name="result" allow="midi; geolocation; microphone; camera;
|
84 |
display-capture; encrypted-media;" sandbox="allow-modals allow-forms
|