Spaces:
Runtime error
Runtime error
Commit
·
13679ee
1
Parent(s):
85a1b63
model examples and ui improvement
Browse files- app.py +13 -5
- examples/BRATS_109.nii.gz +3 -0
- examples/BRATS_225.nii.gz +3 -0
- examples/BRATS_485.nii.gz +3 -0
app.py
CHANGED
@@ -63,10 +63,12 @@ def inference(input):
|
|
63 |
|
64 |
examples = [
|
65 |
['examples/BRATS_225.nii.gz', 83, 2],
|
|
|
|
|
66 |
]
|
67 |
|
68 |
|
69 |
-
def
|
70 |
tumor_file_path = tumor_file.name
|
71 |
processed_data = preproc_transforms({'image': [tumor_file_path]})
|
72 |
tensor_3d_input = processed_data['image'].unsqueeze(0).to('cpu')
|
@@ -88,13 +90,19 @@ def sepia(tumor_file, slice_number, channel, audio_question):
|
|
88 |
return (channel_image, segment_image, "Question answer")
|
89 |
|
90 |
|
91 |
-
interface = gr.Interface(fn=
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
outputs=[gr.Image(label='channel', shape=(1, 1)),
|
96 |
gr.Image(label='Segmented Tumor', shape=(1, 1)),
|
97 |
gr.Textbox(label="Medical Summary")], title=title,
|
|
|
98 |
description=description, outputs_layout="row", theme='dark')
|
99 |
|
|
|
|
|
|
|
|
|
|
|
100 |
interface.launch(debug=True)
|
|
|
63 |
|
64 |
examples = [
|
65 |
['examples/BRATS_225.nii.gz', 83, 2],
|
66 |
+
['examples/BRATS_485.nii.gz', 90, 1],
|
67 |
+
['examples/BRATS_485.nii.gz', 110, 0]
|
68 |
]
|
69 |
|
70 |
|
71 |
+
def detector(tumor_file, slice_number, channel, audio_question):
|
72 |
tumor_file_path = tumor_file.name
|
73 |
processed_data = preproc_transforms({'image': [tumor_file_path]})
|
74 |
tensor_3d_input = processed_data['image'].unsqueeze(0).to('cpu')
|
|
|
90 |
return (channel_image, segment_image, "Question answer")
|
91 |
|
92 |
|
93 |
+
interface = gr.Interface(fn=detector, inputs=[gr.File(label="Tumor File"),
|
94 |
+
gr.Slider(0, 200, 50, step=1, label="Slice Number"),
|
95 |
+
gr.Radio([0, 1, 2], label="Channel"),
|
96 |
+
gr.Audio(source="microphone"), ],
|
97 |
outputs=[gr.Image(label='channel', shape=(1, 1)),
|
98 |
gr.Image(label='Segmented Tumor', shape=(1, 1)),
|
99 |
gr.Textbox(label="Medical Summary")], title=title,
|
100 |
+
examples=examples,
|
101 |
description=description, outputs_layout="row", theme='dark')
|
102 |
|
103 |
+
theme = gr.themes.Default().set(
|
104 |
+
button_primary_background_fill="#FF0000",
|
105 |
+
button_primary_background_fill_dark="#AAAAAA",
|
106 |
+
)
|
107 |
+
|
108 |
interface.launch(debug=True)
|
examples/BRATS_109.nii.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4873bc09872391983979b10cfccd3c5bb30b84ff2c824cb4130cb7a7dfb1f1ec
|
3 |
+
size 8590962
|
examples/BRATS_225.nii.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e2757295889234461bb24cbe499f1eafdc6b2555147308e7f2c62025db5531d8
|
3 |
+
size 10837716
|
examples/BRATS_485.nii.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1de6be1eeb49c788baa286a21d71546b2974bc300d5bc6ce4541e41854a0fefb
|
3 |
+
size 8327084
|