| import time |
| import json |
| import gradio as gr |
| from gradio_molecule3d import Molecule3D |
| from inference_base import inference |
|
|
|
|
| def predict (input_seq_1, input_msa_1, input_protein_1, input_seq_2,input_msa_2, input_protein_2): |
| start_time = time.time() |
| |
| metrics = inference(input_protein_1, input_protein_2) |
|
|
| |
| |
| |
| end_time = time.time() |
| run_time = end_time - start_time |
| return "output.pdb",json.dumps(metrics), 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_msa_1 = gr.File(label="Input MSA Protein 1 (A3M)") |
| input_protein_1 = gr.File(label="Input Protein 2 monomer (PDB)") |
| with gr.Column(): |
| input_seq_2 = gr.Textbox(lines=3, label="Input Protein 2 sequence (FASTA)") |
| input_msa_2 = gr.File(label="Input MSA Protein 2 (A3M)") |
| input_protein_2 = gr.File(label="Input Protein 2 structure (PDB)") |
| |
| |
| |
| |
|
|
| |
| |
| |
| |
|
|
| btn = gr.Button("Run Inference") |
|
|
| gr.Examples( |
| [ |
| [ |
| "GSGSPLAQQIKNIHSFIHQAKAAGRMDEVRTLQENLHQLMHEYFQQSD", |
| "3v1c_A.pdb", |
| "GSGSPLAQQIKNIHSFIHQAKAAGRMDEVRTLQENLHQLMHEYFQQSD", |
| "3v1c_B.pdb", |
| |
| ], |
| ], |
| [input_seq_1, input_protein_1, input_seq_2, input_protein_2], |
| ) |
| reps = [ |
| { |
| "model": 0, |
| "style": "cartoon", |
| "chain": "A", |
| "color": "whiteCarbon", |
| }, |
| { |
| "model": 0, |
| "style": "cartoon", |
| "chain": "B", |
| "color": "greenCarbon", |
| }, |
| { |
| "model": 0, |
| "style": "cartoon", |
| "chain": "C", |
| "color": "blueCarbon", |
| }, |
| { |
| "model": 0, |
| "chain": "A", |
| "style": "stick", |
| "sidechain": True, |
| "color": "whiteCarbon", |
| }, |
| { |
| "model": 0, |
| "chain": "B", |
| "style": "stick", |
| "sidechain": True, |
| "color": "greenCarbon" |
| }, |
| { |
| "model": 0, |
| "chain": "C", |
| "style": "stick", |
| "sidechain": True, |
| "color": "blueCarbon" |
| }, |
| ] |
| |
| |
| out = Molecule3D(reps=reps) |
| metrics = gr.JSON(label="Metrics") |
| run_time = gr.Textbox(label="Runtime") |
|
|
| btn.click(predict, inputs=[input_seq_1, input_msa_1, input_protein_1, input_seq_2, input_msa_2, input_protein_2], outputs=[out, metrics, run_time]) |
|
|
| app.launch() |
|
|