|
import gradio as gr |
|
from main_func import * |
|
|
|
title = "# DeepDR Web Server" |
|
|
|
with gr.Blocks() as demo: |
|
gr.Markdown(title) |
|
gr.Markdown("Inference using the trained model.") |
|
|
|
with gr.Row(): |
|
with gr.Column(): |
|
with gr.Row(): |
|
with gr.Column(): |
|
cell_name = gr.Textbox(value='CAL120', label="Cell name", interactive=True) |
|
drug_name = gr.Textbox(value='Afuresertib', label="Drug name", interactive=True) |
|
model_file = gr.File(label="Trained model") |
|
|
|
with gr.Row(): |
|
clear = gr.Button("Clear output", elem_classes="clear") |
|
submit = gr.Button("Start inference", elem_classes="submit") |
|
response = gr.Textbox(label="Predicted drug response", interactive=False) |
|
|
|
with gr.Column(): |
|
pair_input = gr.Radio(['CCLE (ActArea)', 'CCLE (IC50)', 'GDSC1 (AUC)', 'GDSC1 (IC50)', |
|
'GDSC2 (AUC)', 'GDSC2 (IC50)'], |
|
label="Dataset", value='CCLE (ActArea)', interactive=False) |
|
with gr.Row(): |
|
cell_input = gr.Radio(['EXP', 'PES', 'MUT', 'CNV'], label="Cell feature", value='EXP') |
|
drug_input = gr.Radio(['FP', 'SMILES', 'Graph', 'Img'], label="Drug feature", value='Graph') |
|
split_mode = gr.Radio(['Rand', 'Cell', 'Drug', 'Strict'], |
|
label="Splitting", value='Cell', interactive=False) |
|
gr.Examples([ |
|
['model1.pkl', 'CCLE (ActArea)', 'Cell', 'EXP', 'Graph'] |
|
], inputs=[model_file, pair_input, split_mode, cell_input, drug_input], label="Example") |
|
|
|
submit.click(fn=func2, inputs=[cell_name, drug_name, model_file, cell_input, drug_input], |
|
outputs=[response]) |
|
clear.click(fn=clear_func2, inputs=[], outputs=[response]) |
|
|
|
demo.launch(favicon_path="IC50.png") |
|
|