vincentgao95 commited on
Commit
cca7c91
1 Parent(s): c59e55b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -43,7 +43,8 @@ def visualize_slice(file_obj, slice_index):
43
 
44
  def update_slider(file_obj):
45
  _, num_slices = load_nrrd(file_obj)
46
- return gr.update(maximum=num_slices-1, value=0)
 
47
 
48
  with gr.Blocks() as app:
49
  gr.Markdown("## NRRD Slice Visualizer")
 
43
 
44
  def update_slider(file_obj):
45
  _, num_slices = load_nrrd(file_obj)
46
+ middle_slice = num_slices // 2 # Calculate the middle slice
47
+ return gr.update(maximum=num_slices-1, value=middle_slice) # Set the slider to start in the middle
48
 
49
  with gr.Blocks() as app:
50
  gr.Markdown("## NRRD Slice Visualizer")