Spaces:
Sleeping
Sleeping
checkbox
Browse files
app.py
CHANGED
@@ -401,11 +401,13 @@ def generate_heatmap(protein_fasta):
|
|
401 |
return img
|
402 |
|
403 |
|
404 |
-
def main_function_single(sequence):
|
405 |
# Process seq, and return outputs for both fam and don
|
406 |
family_label, family_img, _, family_info = process_family_sequence(sequence)
|
407 |
donor_label, donor_img, *_ = process_single_sequence(sequence)
|
408 |
-
figmap =
|
|
|
|
|
409 |
return family_label, family_img, family_info, donor_label, donor_img, figmap
|
410 |
|
411 |
def main_function_upload(protein_file): #, progress=gr.Progress()
|
@@ -415,7 +417,6 @@ prediction_imagefam = gr.outputs.Image(type='pil', label="Family prediction grap
|
|
415 |
prediction_imagedonor = gr.outputs.Image(type='pil', label="Donor prediction graph")
|
416 |
prediction_explain = gr.outputs.Image(type='pil', label="Donor prediction explanation")
|
417 |
|
418 |
-
|
419 |
with gr.Blocks() as app:
|
420 |
gr.Markdown("# Glydentify")
|
421 |
|
@@ -423,6 +424,7 @@ with gr.Blocks() as app:
|
|
423 |
with gr.Row().style(equal_height=True):
|
424 |
with gr.Column():
|
425 |
sequence = gr.inputs.Textbox(lines=16, placeholder='Enter Protein Sequence Here...', label="Protein Sequence")
|
|
|
426 |
with gr.Column():
|
427 |
with gr.Accordion("Example:"):
|
428 |
gr.Markdown("""
|
@@ -445,9 +447,10 @@ with gr.Blocks() as app:
|
|
445 |
with gr.Row().style(equal_height=True):
|
446 |
with gr.Column():
|
447 |
predict_button = gr.Button("Predict")
|
448 |
-
|
449 |
-
|
450 |
-
|
|
|
451 |
|
452 |
# Family & Donor Section
|
453 |
with gr.Row().style(equal_height=True):
|
@@ -458,8 +461,9 @@ with gr.Blocks() as app:
|
|
458 |
|
459 |
# Explain Section
|
460 |
with gr.Column():
|
461 |
-
|
462 |
-
|
|
|
463 |
|
464 |
with gr.Tab("Multiple Sequence Prediction"):
|
465 |
with gr.Row().style(equal_height=True):
|
|
|
401 |
return img
|
402 |
|
403 |
|
404 |
+
def main_function_single(sequence, show_explanation):
|
405 |
# Process seq, and return outputs for both fam and don
|
406 |
family_label, family_img, _, family_info = process_family_sequence(sequence)
|
407 |
donor_label, donor_img, *_ = process_single_sequence(sequence)
|
408 |
+
figmap = None
|
409 |
+
if show_explanation:
|
410 |
+
figmap = generate_heatmap(sequence)
|
411 |
return family_label, family_img, family_info, donor_label, donor_img, figmap
|
412 |
|
413 |
def main_function_upload(protein_file): #, progress=gr.Progress()
|
|
|
417 |
prediction_imagedonor = gr.outputs.Image(type='pil', label="Donor prediction graph")
|
418 |
prediction_explain = gr.outputs.Image(type='pil', label="Donor prediction explanation")
|
419 |
|
|
|
420 |
with gr.Blocks() as app:
|
421 |
gr.Markdown("# Glydentify")
|
422 |
|
|
|
424 |
with gr.Row().style(equal_height=True):
|
425 |
with gr.Column():
|
426 |
sequence = gr.inputs.Textbox(lines=16, placeholder='Enter Protein Sequence Here...', label="Protein Sequence")
|
427 |
+
explanation_checkbox = gr.inputs.Checkbox(label="Show Explanation", default=False)
|
428 |
with gr.Column():
|
429 |
with gr.Accordion("Example:"):
|
430 |
gr.Markdown("""
|
|
|
447 |
with gr.Row().style(equal_height=True):
|
448 |
with gr.Column():
|
449 |
predict_button = gr.Button("Predict")
|
450 |
+
predict_button.click(main_function_single, inputs=[sequence, explanation_checkbox],
|
451 |
+
outputs=[family_prediction, prediction_imagefam, info_markdown,
|
452 |
+
donor_prediction, prediction_imagedonor, prediction_explain])
|
453 |
+
|
454 |
|
455 |
# Family & Donor Section
|
456 |
with gr.Row().style(equal_height=True):
|
|
|
461 |
|
462 |
# Explain Section
|
463 |
with gr.Column():
|
464 |
+
if explanation_checkbox: # Only render if the checkbox is checked
|
465 |
+
with gr.Accordion("Donor explanation"):
|
466 |
+
prediction_explain.render() # = gr.outputs.Image(type='pil', label="Donor prediction explaination")
|
467 |
|
468 |
with gr.Tab("Multiple Sequence Prediction"):
|
469 |
with gr.Row().style(equal_height=True):
|