Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,13 +3,25 @@ import os
|
|
| 3 |
import sys
|
| 4 |
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
def generate(input_file):
|
| 7 |
try:
|
| 8 |
path = input_file.name
|
| 9 |
except:
|
| 10 |
-
return 'Error
|
| 11 |
|
| 12 |
-
return 'Success!'
|
| 13 |
|
| 14 |
|
| 15 |
demo = gr.Blocks()
|
|
@@ -17,12 +29,14 @@ with demo:
|
|
| 17 |
gr.Markdown('# DiffLinker: Equivariant 3D-Conditional Diffusion Model for Molecular Linker Design')
|
| 18 |
with gr.Box():
|
| 19 |
with gr.Row():
|
| 20 |
-
gr.
|
| 21 |
-
|
|
|
|
|
|
|
| 22 |
|
| 23 |
button = gr.Button('Generate Linker!')
|
| 24 |
|
| 25 |
-
gr.Markdown('
|
| 26 |
visualization = gr.HTML()
|
| 27 |
|
| 28 |
button.click(
|
|
|
|
| 3 |
import sys
|
| 4 |
|
| 5 |
|
| 6 |
+
HTML_TEMPLATE = '''<!DOCTYPE html>
|
| 7 |
+
<html>
|
| 8 |
+
<head>
|
| 9 |
+
</head>
|
| 10 |
+
<body>
|
| 11 |
+
<h1>Result:</h1>
|
| 12 |
+
{content}
|
| 13 |
+
</body>
|
| 14 |
+
</html>
|
| 15 |
+
'''
|
| 16 |
+
|
| 17 |
+
|
| 18 |
def generate(input_file):
|
| 19 |
try:
|
| 20 |
path = input_file.name
|
| 21 |
except:
|
| 22 |
+
return HTML_TEMPLATE.format(content='Error: could not open the provided file')
|
| 23 |
|
| 24 |
+
return HTML_TEMPLATE.format(content=f'Success! File={}'.format(path))
|
| 25 |
|
| 26 |
|
| 27 |
demo = gr.Blocks()
|
|
|
|
| 29 |
gr.Markdown('# DiffLinker: Equivariant 3D-Conditional Diffusion Model for Molecular Linker Design')
|
| 30 |
with gr.Box():
|
| 31 |
with gr.Row():
|
| 32 |
+
with gr.Column():
|
| 33 |
+
gr.Markdown('## Input Fragments')
|
| 34 |
+
gr.Markdown('Upload the file with 3D-coordinates of the input fragments in .mol or .sdf format')
|
| 35 |
+
input_file = gr.File(file_count='single', label='Input fragments in .mol2 or .sdf format')
|
| 36 |
|
| 37 |
button = gr.Button('Generate Linker!')
|
| 38 |
|
| 39 |
+
gr.Markdown('')
|
| 40 |
visualization = gr.HTML()
|
| 41 |
|
| 42 |
button.click(
|