raylim commited on
Commit
0d12724
·
1 Parent(s): f86713e

gradio interface

Browse files
Files changed (1) hide show
  1. app.py +26 -31
app.py CHANGED
@@ -50,39 +50,34 @@ def analyze_slide(slide_path, site_type):
50
 
51
  return aeon_results, paladin_results
52
 
53
- with gr.Blocks() as demo:
54
- gr.Markdown("# Mosaic: H&E Whole Slide Image Cancer Subtype and Biomarker Inference")
55
- with gr.Row():
56
- with gr.Column():
57
- input_slide = gr.File(
58
- label="Upload H&E Whole Slide Image",
59
- file_types=[".svs", ".tiff", ".tif"],
60
- )
61
- input_dropdown = gr.Dropdown(
62
- choices=["Primary", "Metastatic"],
63
- label="Site Type",
64
- value="Primary",
65
- )
66
- run_button = gr.Button("Run Inference")
67
- with gr.Column():
68
- aeon_output_table = gr.Dataframe(
69
- headers=["Cancer Subtype", "Confidence"],
70
- label="Cancer Subtype Inference",
71
- datatype=["str", "number"],
72
- )
73
- paladin_output_table = gr.Dataframe(
74
- headers=["Cancer Subtype", "Biomarker", "Score"],
75
- label="Biomarker Inference",
76
- datatype=["str", "str", "number"],
77
- )
78
-
79
 
80
- run_button.click(
81
- analyze_slide,
82
  inputs=[input_slide, input_dropdown],
83
  outputs=[aeon_output_table, paladin_output_table],
84
-
 
 
85
  )
86
 
87
- if __name__ == "__main__":
88
- demo.launch(enable_queue=True)
 
50
 
51
  return aeon_results, paladin_results
52
 
53
+ if __name__ == "__main__":
54
+ input_slide = gr.File(
55
+ label="Upload H&E Whole Slide Image",
56
+ file_types=[".svs", ".tiff", ".tif"],
57
+ )
58
+ input_dropdown = gr.Dropdown(
59
+ choices=["Primary", "Metastatic"],
60
+ label="Site Type",
61
+ value="Primary",
62
+ )
63
+ aeon_output_table = gr.Dataframe(
64
+ headers=["Cancer Subtype", "Confidence"],
65
+ label="Cancer Subtype Inference",
66
+ datatype=["str", "number"],
67
+ )
68
+ paladin_output_table = gr.Dataframe(
69
+ headers=["Cancer Subtype", "Biomarker", "Score"],
70
+ label="Biomarker Inference",
71
+ datatype=["str", "str", "number"],
72
+ )
 
 
 
 
 
 
73
 
74
+ iface = gr.Interface(
75
+ fn=analyze_slide,
76
  inputs=[input_slide, input_dropdown],
77
  outputs=[aeon_output_table, paladin_output_table],
78
+ title="Mosaic: H&E Whole Slide Image Cancer Subtype and Biomarker Inference",
79
+ description="Upload an H&E whole slide image and select the site type to infer cancer subtype and biomarkers.",
80
+ allow_flagging="never",
81
  )
82
 
83
+ iface.launch(enable_queue=True)