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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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,7 +76,7 @@ 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") # Adjust max value based on image size
80
  ],
81
  outputs=[
82
  gr.Plot(label="2D Slice Visualization"),
 
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", live=True) # Set live=True for dynamic updates
80
  ],
81
  outputs=[
82
  gr.Plot(label="2D Slice Visualization"),