File size: 1,116 Bytes
7782ac2
 
 
 
 
711f689
 
 
 
 
 
 
 
 
 
 
 
7782ac2
 
 
 
711f689
7782ac2
711f689
7782ac2
 
 
 
 
 
 
711f689
 
 
 
7782ac2
 
 
711f689
7782ac2
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import gradio as gr
import os
import sys


HTML_TEMPLATE = '''<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Result:</h1>
{content}
</body>
</html>
'''


def generate(input_file):
    try:
        path = input_file.name
    except:
        return HTML_TEMPLATE.format(content='Error: could not open the provided file')
    
    return HTML_TEMPLATE.format(content=f'Success! File={}'.format(path))


demo = gr.Blocks()
with demo:
    gr.Markdown('# DiffLinker: Equivariant 3D-Conditional Diffusion Model for Molecular Linker Design')
    with gr.Box():
        with gr.Row():
            with gr.Column():
                gr.Markdown('## Input Fragments')
                gr.Markdown('Upload the file with 3D-coordinates of the input fragments in .mol or .sdf format')
                input_file = gr.File(file_count='single', label='Input fragments in .mol2 or .sdf format')
            
    button = gr.Button('Generate Linker!')
    
    gr.Markdown('')
    visualization = gr.HTML()
    
    button.click(
        fn=generate,
        inputs=[input_file],
        outputs=[visualization],
    )

demo.launch()