import gradio as gr
import os
import sys
HTML_TEMPLATE = '''
Result:
{content}
'''
VIS_TEMPLATE = '''
'''
PARAMS = ''''''
def generate(input_file):
try:
path = input_file.name
except:
return HTML_TEMPLATE.format(content='Error: could not open the provided file')
content = VIS_TEMPLATE
html = HTML_TEMPLATE.format(content=content)
return PARAMS.format(html=html)
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 .pdb, .mol or .sdf format')
input_file = gr.File(file_count='single', label='Input fragments in .pdb, .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()