Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,11 +7,13 @@ HTML_TEMPLATE = '''<!DOCTYPE html>
|
|
| 7 |
<html>
|
| 8 |
|
| 9 |
<head>
|
|
|
|
| 10 |
<style>
|
| 11 |
.mol-container {{
|
| 12 |
-
width:
|
| 13 |
-
height:
|
| 14 |
position: relative;
|
|
|
|
| 15 |
}}
|
| 16 |
</style>
|
| 17 |
<script src="http://3Dmol.csb.pitt.edu/build/3Dmol-min.js""></script>
|
|
@@ -40,6 +42,8 @@ $(function() {
|
|
| 40 |
</script>
|
| 41 |
'''
|
| 42 |
|
|
|
|
|
|
|
| 43 |
|
| 44 |
def generate(input_file):
|
| 45 |
try:
|
|
@@ -48,7 +52,8 @@ def generate(input_file):
|
|
| 48 |
return HTML_TEMPLATE.format(content='Error: could not open the provided file')
|
| 49 |
|
| 50 |
content = VIS_TEMPLATE
|
| 51 |
-
|
|
|
|
| 52 |
|
| 53 |
|
| 54 |
demo = gr.Blocks()
|
|
|
|
| 7 |
<html>
|
| 8 |
|
| 9 |
<head>
|
| 10 |
+
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
| 11 |
<style>
|
| 12 |
.mol-container {{
|
| 13 |
+
width: 600px;
|
| 14 |
+
height: 600px;
|
| 15 |
position: relative;
|
| 16 |
+
mx-auto:0
|
| 17 |
}}
|
| 18 |
</style>
|
| 19 |
<script src="http://3Dmol.csb.pitt.edu/build/3Dmol-min.js""></script>
|
|
|
|
| 42 |
</script>
|
| 43 |
'''
|
| 44 |
|
| 45 |
+
PARAMS = '''<iframe style="width: 100%; height: 700px" name="result" allow="midi; geolocation; microphone; camera; display-capture; encrypted-media;" sandbox="allow-modals allow-forms allow-scripts allow-same-origin allow-popups allow-top-navigation-by-user-activation allow-downloads" allowfullscreen="" allowpaymentrequest="" frameborder="0" srcdoc='{html}'></iframe>'''
|
| 46 |
+
|
| 47 |
|
| 48 |
def generate(input_file):
|
| 49 |
try:
|
|
|
|
| 52 |
return HTML_TEMPLATE.format(content='Error: could not open the provided file')
|
| 53 |
|
| 54 |
content = VIS_TEMPLATE
|
| 55 |
+
html = HTML_TEMPLATE.format(content=content)
|
| 56 |
+
return PARAMS.format(html=html)
|
| 57 |
|
| 58 |
|
| 59 |
demo = gr.Blocks()
|