Spaces:
Sleeping
Sleeping
test
Browse files
app.py
CHANGED
|
@@ -1,16 +1,24 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import numpy as np
|
| 3 |
from PIL import Image
|
| 4 |
-
import tempfile
|
| 5 |
|
| 6 |
from mussel.utils import extract_features, segment_tissue
|
| 7 |
|
| 8 |
def analyze_slide(slide_path, model_name="RESNET50"):
|
| 9 |
-
patch_h5_path =
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
with gr.Blocks() as demo:
|
| 16 |
gr.Markdown("# Whole Slide Image Featurization & Inference")
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import numpy as np
|
| 3 |
from PIL import Image
|
|
|
|
| 4 |
|
| 5 |
from mussel.utils import extract_features, segment_tissue
|
| 6 |
|
| 7 |
def analyze_slide(slide_path, model_name="RESNET50"):
|
| 8 |
+
patch_h5_path = "patches.h5"
|
| 9 |
+
segment_tissue(
|
| 10 |
+
slide_path=slide_path,
|
| 11 |
+
output_h5_path=patch_h5_path,
|
| 12 |
+
patch_size=224)
|
| 13 |
+
feature_h5_path = "features.h5"
|
| 14 |
+
extract_features(
|
| 15 |
+
slide_path,
|
| 16 |
+
output_h5_path=feature_h5_path,
|
| 17 |
+
patch_h5_path=patch_h5_path,
|
| 18 |
+
model_type=model_name
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
return feature_h5_path
|
| 22 |
|
| 23 |
with gr.Blocks() as demo:
|
| 24 |
gr.Markdown("# Whole Slide Image Featurization & Inference")
|