soumickmj commited on
Commit
9454e59
1 Parent(s): bbd86c5

trial version ready

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -10,7 +10,7 @@ import tempfile
10
  from pathlib import Path
11
  from skimage.filters import threshold_otsu
12
  import torchio as tio
13
- import psutil
14
 
15
  def infer_full_vol(tensor, model):
16
  tensor = tensor.unsqueeze(0).unsqueeze(0) # Shape: [1, 1, D, H, W] - adding batch and channel dims
@@ -61,7 +61,7 @@ def infer_patch_based(tensor, model, patch_size=64, stride_length=32, stride_wid
61
  total_batches = len(patch_loader)
62
  progress_bar = st.progress(0)
63
  for i, patches_batch in enumerate(patch_loader):
64
- st.text(f"Processing batch {i + 1} of {total_batches}... ({((i + 1) / total_batches) * 100:.2f}% complete)")
65
 
66
  local_batch = patches_batch['img'][tio.DATA].float()
67
  local_batch = local_batch / local_batch.max()
@@ -78,7 +78,7 @@ def infer_patch_based(tensor, model, patch_size=64, stride_length=32, stride_wid
78
  aggregator.add_batch(output, locations)
79
 
80
  progress_bar.progress((i + 1) / total_batches)
81
- st.text(f"CPU usage: {psutil.cpu_percent()}% | RAM usage: {psutil.virtual_memory().percent}%")
82
 
83
  predicted = aggregator.get_output_tensor().squeeze().numpy()
84
 
@@ -130,11 +130,11 @@ if selected_mode == "Patch-based inference [Default for DS6]":
130
  patch_size = st.number_input("Patch size:", min_value=1, value=64)
131
  stride_length = st.number_input("Stride length:", min_value=1, value=32)
132
  with col2:
 
133
  stride_width = st.number_input("Stride width:", min_value=1, value=32)
134
- stride_depth = st.number_input("Stride depth:", min_value=1, value=16)
135
  with col3:
136
- batch_size = st.number_input("Batch size:", min_value=1, value=14)
137
  num_worker = st.number_input("Number of workers:", min_value=1, value=3)
 
138
 
139
  # Process button
140
  process_button = st.button("Process")
 
10
  from pathlib import Path
11
  from skimage.filters import threshold_otsu
12
  import torchio as tio
13
+ # import psutil
14
 
15
  def infer_full_vol(tensor, model):
16
  tensor = tensor.unsqueeze(0).unsqueeze(0) # Shape: [1, 1, D, H, W] - adding batch and channel dims
 
61
  total_batches = len(patch_loader)
62
  progress_bar = st.progress(0)
63
  for i, patches_batch in enumerate(patch_loader):
64
+ st.text(f"Processing batch {i + 1} of {total_batches}...")
65
 
66
  local_batch = patches_batch['img'][tio.DATA].float()
67
  local_batch = local_batch / local_batch.max()
 
78
  aggregator.add_batch(output, locations)
79
 
80
  progress_bar.progress((i + 1) / total_batches)
81
+ # st.text(f"CPU usage: {psutil.cpu_percent()}% | RAM usage: {psutil.virtual_memory().percent}%")
82
 
83
  predicted = aggregator.get_output_tensor().squeeze().numpy()
84
 
 
130
  patch_size = st.number_input("Patch size:", min_value=1, value=64)
131
  stride_length = st.number_input("Stride length:", min_value=1, value=32)
132
  with col2:
133
+ batch_size = st.number_input("Batch size:", min_value=1, value=14)
134
  stride_width = st.number_input("Stride width:", min_value=1, value=32)
 
135
  with col3:
 
136
  num_worker = st.number_input("Number of workers:", min_value=1, value=3)
137
+ stride_depth = st.number_input("Stride depth:", min_value=1, value=16)
138
 
139
  # Process button
140
  process_button = st.button("Process")