Spaces:
Sleeping
Sleeping
fangjiang
commited on
Commit
·
a25ae65
1
Parent(s):
a6e2b1b
temporarily remove case 1 in step 1
Browse files
app.py
CHANGED
|
@@ -390,37 +390,55 @@ with gr.Blocks() as demo:
|
|
| 390 |
gr.HTML(custom_css)
|
| 391 |
|
| 392 |
gr.Markdown('<div class="h-1">Step 1. Upload images</div>')
|
| 393 |
-
gr.Markdown('<div class="h-2">You may upload one or two files depending on your use case.</div>')
|
| 394 |
-
gr.Markdown('<div class="h-2 bold">Case 1: Upload a single file</div>')
|
| 395 |
-
gr.Markdown('<div class="h-2"><ul><li>upload a TXT or CSV file that contains information about antibodies, rare heavy metal isotopes, and image channel names.</li>'
|
| 396 |
-
'<li>files are following the CyTOF, IMC, or multiplex data convention.</li>'
|
| 397 |
-
'</ul></div>')
|
| 398 |
-
gr.Markdown('<div class="h-2 bold">Case 2: Upload multiple files</div>')
|
|
|
|
| 399 |
gr.Markdown('<div class="h-2"><ul><li>upload a TIFF file containing Regions of Interest (ROIs) stored as multiplexed images. <a href="https://qbrc.swmed.edu/labs/xiaoxie/download/multiplex/example_image.tiff" download target="_blank">Example ROI</a></li>'
|
| 400 |
'<li>upload a Marker File listing the channels to identify the antibodies. <a href="https://github.com/QBRC/multiTAP/blob/main/notebooks/supplemental/markers_labels_BrCa.txt" download target="_blank">Example Marker File</a></li>'
|
| 401 |
'</ul></div><hr>')
|
| 402 |
|
| 403 |
-
gr.Markdown('<div class="h-2">Select Input Case:</div>')
|
| 404 |
|
| 405 |
-
choices = gr.Radio(["Case 1", "Case 2"], value="Case 1", label="Choose Input Case", elem_classes='input-choices')
|
| 406 |
-
|
| 407 |
-
def toggle_file_input(choice):
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 418 |
|
| 419 |
with gr.Row(equal_height=True): # second row where 1) asks for marker file upload and 2) displays the visualization of individual channels
|
| 420 |
with gr.Column(scale=2):
|
| 421 |
gr.Markdown('<div class="h-2">File Input:</div>')
|
| 422 |
-
img_path = gr.File(file_types=[
|
| 423 |
-
marker_path = gr.File(file_types=['.txt'], label='Marker File', visible=
|
| 424 |
with gr.Row():
|
| 425 |
clear_btn = gr.Button("Clear")
|
| 426 |
submit_btn = gr.Button("Upload")
|
|
@@ -430,8 +448,6 @@ with gr.Blocks() as demo:
|
|
| 430 |
gr.Markdown('<div class="h-3">Visualization of individual channels:</div>')
|
| 431 |
with gr.Accordion("", open=True):
|
| 432 |
img_viz = gr.Plot(elem_classes='no-label no-border')
|
| 433 |
-
|
| 434 |
-
choices.change(fn=toggle_file_input, inputs=choices, outputs=[img_path, marker_path])
|
| 435 |
|
| 436 |
# img_viz = gr.Plot(label="Visualization of individual channels")
|
| 437 |
gr.Markdown('<br>')
|
|
|
|
| 390 |
gr.HTML(custom_css)
|
| 391 |
|
| 392 |
gr.Markdown('<div class="h-1">Step 1. Upload images</div>')
|
| 393 |
+
# gr.Markdown('<div class="h-2">You may upload one or two files depending on your use case.</div>')
|
| 394 |
+
# gr.Markdown('<div class="h-2 bold">Case 1: Upload a single file</div>')
|
| 395 |
+
# gr.Markdown('<div class="h-2"><ul><li>upload a TXT or CSV file that contains information about antibodies, rare heavy metal isotopes, and image channel names.</li>'
|
| 396 |
+
# '<li>files are following the CyTOF, IMC, or multiplex data convention.</li>'
|
| 397 |
+
# '</ul></div>')
|
| 398 |
+
# gr.Markdown('<div class="h-2 bold">Case 2: Upload multiple files</div>')
|
| 399 |
+
gr.Markdown('<div class="h-2 bold">Upload multiple files</div>')
|
| 400 |
gr.Markdown('<div class="h-2"><ul><li>upload a TIFF file containing Regions of Interest (ROIs) stored as multiplexed images. <a href="https://qbrc.swmed.edu/labs/xiaoxie/download/multiplex/example_image.tiff" download target="_blank">Example ROI</a></li>'
|
| 401 |
'<li>upload a Marker File listing the channels to identify the antibodies. <a href="https://github.com/QBRC/multiTAP/blob/main/notebooks/supplemental/markers_labels_BrCa.txt" download target="_blank">Example Marker File</a></li>'
|
| 402 |
'</ul></div><hr>')
|
| 403 |
|
| 404 |
+
# gr.Markdown('<div class="h-2">Select Input Case:</div>')
|
| 405 |
|
| 406 |
+
# choices = gr.Radio(["Case 1", "Case 2"], value="Case 1", label="Choose Input Case", elem_classes='input-choices')
|
| 407 |
+
|
| 408 |
+
# def toggle_file_input(choice):
|
| 409 |
+
# if choice == "Case 1":
|
| 410 |
+
# return (
|
| 411 |
+
# gr.update(visible=True, file_types=['.txt', '.csv'], label="TXT or CSV File"),
|
| 412 |
+
# gr.update(visible=False)
|
| 413 |
+
# )
|
| 414 |
+
# else:
|
| 415 |
+
# return (
|
| 416 |
+
# gr.update(visible=True, file_types=[".tiff", '.tif'], label="TIFF File"),
|
| 417 |
+
# gr.update(visible=True)
|
| 418 |
+
# )
|
| 419 |
+
|
| 420 |
+
# with gr.Row(equal_height=True): # second row where 1) asks for marker file upload and 2) displays the visualization of individual channels
|
| 421 |
+
# with gr.Column(scale=2):
|
| 422 |
+
# gr.Markdown('<div class="h-2">File Input:</div>')
|
| 423 |
+
# img_path = gr.File(file_types=['.txt', '.csv'], label='TXT or CSV File')
|
| 424 |
+
# marker_path = gr.File(file_types=['.txt'], label='Marker File', visible=False)
|
| 425 |
+
# with gr.Row():
|
| 426 |
+
# clear_btn = gr.Button("Clear")
|
| 427 |
+
# submit_btn = gr.Button("Upload")
|
| 428 |
+
# with gr.Column(scale=3):
|
| 429 |
+
# gr.Markdown('<div class="h-2">Marker Information:</div>')
|
| 430 |
+
# img_info = gr.Textbox(label='Ensure the number of markers displayed below matches the expected number.')
|
| 431 |
+
# gr.Markdown('<div class="h-3">Visualization of individual channels:</div>')
|
| 432 |
+
# with gr.Accordion("", open=True):
|
| 433 |
+
# img_viz = gr.Plot(elem_classes='no-label no-border')
|
| 434 |
+
|
| 435 |
+
# choices.change(fn=toggle_file_input, inputs=choices, outputs=[img_path, marker_path])
|
| 436 |
|
| 437 |
with gr.Row(equal_height=True): # second row where 1) asks for marker file upload and 2) displays the visualization of individual channels
|
| 438 |
with gr.Column(scale=2):
|
| 439 |
gr.Markdown('<div class="h-2">File Input:</div>')
|
| 440 |
+
img_path = gr.File(visible=True, file_types=[".tiff", '.tif'], label="TIFF File")
|
| 441 |
+
marker_path = gr.File(file_types=['.txt'], label='Marker File', visible=True)
|
| 442 |
with gr.Row():
|
| 443 |
clear_btn = gr.Button("Clear")
|
| 444 |
submit_btn = gr.Button("Upload")
|
|
|
|
| 448 |
gr.Markdown('<div class="h-3">Visualization of individual channels:</div>')
|
| 449 |
with gr.Accordion("", open=True):
|
| 450 |
img_viz = gr.Plot(elem_classes='no-label no-border')
|
|
|
|
|
|
|
| 451 |
|
| 452 |
# img_viz = gr.Plot(label="Visualization of individual channels")
|
| 453 |
gr.Markdown('<br>')
|