Hemaxi commited on
Commit
ac9ba9f
·
verified ·
1 Parent(s): 1475239

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -47,8 +47,8 @@ def visualize_slice(image, mask, slice_index):
47
  fig, axes = plt.subplots(1, 2, figsize=(12, 6))
48
 
49
  # Extract the 2D slices
50
- image_slice = image[:, :, slice_index]
51
- mask_slice = mask[:, :, slice_index]
52
 
53
  # Plot image slice
54
  axes[0].imshow(image_slice, cmap="gray")
@@ -76,14 +76,15 @@ iface = gr.Interface(
76
  fn=interface,
77
  inputs=[
78
  gr.File(label="Upload 3D Image (.tif or .czi)"),
79
- gr.Slider(minimum=0, maximum=100, step=1, label="Slice Index", live=True) # Set live=True for dynamic updates
80
  ],
81
  outputs=[
82
  gr.Plot(label="2D Slice Visualization"),
83
  gr.File(label="Download Binary Mask (.tif)")
84
  ],
85
  title="3D Image Processing with Binary Mask Output",
86
- description="Upload a 3D image in .tif or .czi format. The model will process the image and output a 3D binary mask. Use the slider to navigate through the 2D slices."
 
87
  )
88
 
89
  if __name__ == "__main__":
 
47
  fig, axes = plt.subplots(1, 2, figsize=(12, 6))
48
 
49
  # Extract the 2D slices
50
+ image_slice = image[slice_index, :, :]
51
+ mask_slice = mask[slice_index, :, :]
52
 
53
  # Plot image slice
54
  axes[0].imshow(image_slice, cmap="gray")
 
76
  fn=interface,
77
  inputs=[
78
  gr.File(label="Upload 3D Image (.tif or .czi)"),
79
+ gr.Slider(minimum=0, maximum=100, step=1, label="Slice Index") # No live=True
80
  ],
81
  outputs=[
82
  gr.Plot(label="2D Slice Visualization"),
83
  gr.File(label="Download Binary Mask (.tif)")
84
  ],
85
  title="3D Image Processing with Binary Mask Output",
86
+ description="Upload a 3D image in .tif or .czi format. The model will process the image and output a 3D binary mask. Use the slider to navigate through the 2D slices.",
87
+ live=True # Enable real-time updates in Interface
88
  )
89
 
90
  if __name__ == "__main__":