Spaces:
Runtime error
Runtime error
| import time | |
| import gradio as gr | |
| from gradio_molecule3d import Molecule3D | |
| def predict (input_sequence, input_ligand, input_protein): | |
| start_time = time.time() | |
| # Do inference here | |
| # return an output pdb file with the protein and two chains A and B. | |
| 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(): | |
| with gr.Column(): | |
| input_seq_1 = gr.Textbox(lines=3, label="Input Protein 1 sequence (FASTA)") | |
| input_protein_1 = gr.File(label="Input Protein 2 monomer (PDB)") | |
| with gr.Column(): | |
| input_seq_2 = gr.Textbox(lines=3, label="Input Protein 1 sequence (FASTA)") | |
| input_protein_2 = gr.File(label="Input Protein 2 structure (PDB)") | |
| # 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( | |
| [ | |
| [ | |
| "GSGSPLAQQIKNIHSFIHQAKAAGRMDEVRTLQENLHQLMHEYFQQSD", | |
| "3v1c_A.pdb", | |
| "GSGSPLAQQIKNIHSFIHQAKAAGRMDEVRTLQENLHQLMHEYFQQSD", | |
| "3v1c_B.pdb", | |
| ], | |
| ], | |
| [input_sequence, input_ligand], | |
| ) | |
| reps = [ | |
| { | |
| "model": 0, | |
| "style": "cartoon", | |
| "chain": "A", | |
| "color": "whiteCarbon", | |
| }, | |
| { | |
| "model": 0, | |
| "chain": "B", | |
| "style": "stick", | |
| "color": "greenCarbon", | |
| } | |
| ] | |
| out = Molecule3D(reps=reps) | |
| run_time = gr.Textbox(label="Runtime") | |
| btn.click(predict, inputs=[input_seq_1, input_protein_1, input_seq_2, input_protein_2], outputs=[out, run_time]) | |
| app.launch() | |