Spaces:
Running
Running
File size: 3,079 Bytes
bebad14 dffaf30 bebad14 bca3a49 f1046e9 bebad14 f1046e9 d76e1ad bebad14 bca3a49 dadbe2e f1046e9 bca3a49 f1046e9 bebad14 bca3a49 bebad14 bca3a49 bebad14 f1046e9 bca3a49 bebad14 f354223 bebad14 c0df2f3 43105fe f354223 bca3a49 bebad14 28cb117 bebad14 44470f9 28cb117 d76e1ad 28cb117 130e4f7 28cb117 bca3a49 4853a01 bca3a49 28cb117 dadbe2e bebad14 0b45f21 bca3a49 dffaf30 bebad14 |
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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
import time
import gradio as gr
from gradio_molecule3d import Molecule3D
from run_on_seq import run_on_sample_seqs
from env_consts import RUN_CONFIG_PATH, OUTPUT_PROT_PATH, OUTPUT_LIG_PATH, MODEL_NAME_TO_CKPT
def predict(input_sequence, input_ligand, input_msa, input_protein, model_variation):
print("Strating inference!!!!!!!!!!!!!!!!!", input_sequence, input_ligand, input_protein)
start_time = time.time()
# Do inference here
# return an output pdb file with the protein and ligand with resname LIG or UNK.
# also return any metrics you want to log, metrics will not be used for evaluation but might be useful for users
ckpt_path = MODEL_NAME_TO_CKPT[model_variation]
metrics = run_on_sample_seqs(input_sequence, input_protein, input_ligand, OUTPUT_PROT_PATH, OUTPUT_LIG_PATH,
RUN_CONFIG_PATH, ckpt_path)
end_time = time.time()
run_time = end_time - start_time
return [OUTPUT_PROT_PATH, OUTPUT_LIG_PATH], metrics, run_time
with gr.Blocks() as app:
gr.Markdown("DockFormer")
model_variation = gr.Dropdown(
choices=["DockFormer-Screen", "DockFormer-PDBBind", "DockFormer-PLINDER"],
label="Select model variation",
value="DockFormer-Screen" # Default value
)
# gr.Markdown("Title, description, and other information about the model")
with gr.Row():
input_sequence = gr.Textbox(lines=3, label="Input Protein sequence (FASTA)")
input_ligand = gr.Textbox(lines=3, label="Input ligand SMILES")
with gr.Row():
input_msa = gr.File(label="Input Protein MSA (A3M)")
input_protein = gr.File(label="Input protein monomer")
# 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(
[
[
"MLLLPLPLLLFLLCSRAEAGEIIGGTESKPHSRPYMAYLEIVTSNGPSKFCGGFLIRRNFVLTAAHCAGRSITVTLGAHNITEEEDTWQKLEVIKQFRHPKYNTSTLHHDIMLLKLKEKASLTLAVGTLPFPSQKNFVPPGRMCRVAGWGRTGVLKPGSDTLQEVKLRLMDPQACSHFRDFDHNLQLCVGNPRKTKSAFKGDSGGPLLCAGVAQGIVSYGRSDAKPPAVFTRISHYRPWINQILQAN",
"[nH]1c5c(c(c1C(c2ccccc2)C3=C(C(CC3=O)c4ccccc4)O)CCNC(=O)C)ccc(c5)CC",
"resources/example/L1001.pdb"
],
],
[input_sequence, input_ligand, input_protein],
)
reps = [
{
"model": 0,
"style": "cartoon",
"color": "whiteCarbon",
},
{
"model": 1,
"style": "stick",
"color": "greenCarbon",
}
]
out = Molecule3D(reps=reps)
metrics = gr.JSON(label="Metrics")
run_time = gr.Textbox(label="Runtime")
btn.click(predict, inputs=[input_sequence, input_ligand, input_msa, input_protein, model_variation],
outputs=[out, metrics, run_time])
app.launch()
|