Spaces:
Sleeping
Sleeping
| import time | |
| import gradio as gr | |
| from gradio_molecule3d import Molecule3D | |
| def predict (input_sequence, input_ligand): | |
| start_time = time.time() | |
| # Do inference here | |
| # return an output directory | |
| end_time = time.time() | |
| run_time = end_time - start_time | |
| return "test_out.pdb", run_time | |
| with gr.Blocks() as app: | |
| gr.Markdown("# Template for inference") | |
| gr.Markdown("Title, description, and other information about the model") | |
| with gr.Row(): | |
| input_sequence = gr.Textbox(lines=3, label="Input sequence") | |
| input_ligand = gr.Textbox(lines=3, label="Input ligand SMILES") | |
| # define any options here | |
| # for automated inference the default options are used | |
| # slider_option = gr.Slider(0,10, label="Slider Option") | |
| # checkbox_option = gr.Checkbox(label="Checkbox Option") | |
| # dropdown_option = gr.Dropdown(["Option 1", "Option 2", "Option 3"], label="Radio Option") | |
| btn = gr.Button("Run Inference") | |
| gr.Examples( | |
| [ | |
| [ | |
| "SVKSEYAEAAAVGQEAVAVFNTMKAAFQNGDKEAVAQYLARLASLYTRHEELLNRILEKARREGNKEAVTLMNEFTATFQTGKSIFNAMVAAFKNGDDDSFESYLQALEKVTAKGETLADQIAKAL:SVKSEYAEAAAVGQEAVAVFNTMKAAFQNGDKEAVAQYLARLASLYTRHEELLNRILEKARREGNKEAVTLMNEFTATFQTGKSIFNAMVAAFKNGDDDSFESYLQALEKVTAKGETLADQIAKAL" | |
| "COc1ccc(cc1)n2c3c(c(n2)C(=O)N)CCN(C3=O)c4ccc(cc4)N5CCCCC5=O", | |
| ], | |
| ], | |
| [input_sequence, input_ligand], | |
| ) | |
| reps = [ | |
| { | |
| "model": 0, | |
| "chain": "", | |
| "resname": "", | |
| "style": "cartoon", | |
| "color": "whiteCarbon", | |
| "residue_range": "", | |
| "around": 0, | |
| "byres": False, | |
| "visible": False | |
| }, | |
| { | |
| "model": 1, | |
| "chain": "", | |
| "resname": "", | |
| "style": "stick", | |
| "color": "greenCarbon", | |
| "residue_range": "", | |
| "around": 0, | |
| "byres": False, | |
| "visible": False | |
| } | |
| ] | |
| out = Molecule3D(reps=reps) | |
| run_time = gr.Textbox(label="Runtime") | |
| btn.click(predict, inputs=[input_sequence, input_ligand], outputs=[out, run_time]) | |
| app.launch() | |