Update app.py
Browse files
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[
|
51 |
-
mask_slice = mask[
|
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") #
|
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"),
|