awacke1 commited on
Commit
8b72d19
·
verified ·
1 Parent(s): 4c3762f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -535,17 +535,21 @@ with tab1:
535
  with tab2:
536
  st.header("Camera Snap 📷 (Dual Capture!)")
537
  video_devices = get_available_video_devices()
538
- st.subheader("Device Settings ⚙️")
539
  if not video_devices:
540
  st.warning("No video devices detected! 📷 Please connect a camera.")
541
  else:
542
  st.write(f"Detected Video Devices: {', '.join(video_devices)}")
543
- default_cam0 = video_devices[0] if video_devices else None
544
- default_cam1 = video_devices[1] if len(video_devices) > 1 else default_cam0
545
- selected_cam0 = st.selectbox("Select Camera 0", video_devices, index=0 if video_devices else -1, key="cam0_select")
546
- selected_cam1 = st.selectbox("Select Camera 1", video_devices, index=1 if len(video_devices) > 1 else 0, key="cam1_select")
 
 
 
547
  slice_count = st.number_input("Image Slice Count 🎞️", min_value=1, max_value=20, value=10, help="How many snaps to dream of? (Automation’s on vacation! 😜)")
548
  video_length = st.number_input("Video Dream Length (seconds) 🎥", min_value=1, max_value=30, value=10, help="Imagine a vid this long—sadly, we’re stuck with pics for now! 😂")
 
549
  cols = st.columns(2)
550
  with cols[0]:
551
  st.subheader(f"Camera 0 ({selected_cam0}) 🎬" if selected_cam0 else "Camera 0 (None Detected)")
 
535
  with tab2:
536
  st.header("Camera Snap 📷 (Dual Capture!)")
537
  video_devices = get_available_video_devices()
538
+ st.subheader("Camera Settings ⚙️")
539
  if not video_devices:
540
  st.warning("No video devices detected! 📷 Please connect a camera.")
541
  else:
542
  st.write(f"Detected Video Devices: {', '.join(video_devices)}")
543
+
544
+ # Camera selection with defaults
545
+ default_cam0_index = 0 if video_devices else -1
546
+ default_cam1_index = 1 if len(video_devices) > 1 else (0 if video_devices else -1)
547
+ selected_cam0 = st.selectbox("Select Camera 0", video_devices, index=default_cam0_index, key="cam0_select")
548
+ selected_cam1 = st.selectbox("Select Camera 1", video_devices, index=default_cam1_index, key="cam1_select")
549
+
550
  slice_count = st.number_input("Image Slice Count 🎞️", min_value=1, max_value=20, value=10, help="How many snaps to dream of? (Automation’s on vacation! 😜)")
551
  video_length = st.number_input("Video Dream Length (seconds) 🎥", min_value=1, max_value=30, value=10, help="Imagine a vid this long—sadly, we’re stuck with pics for now! 😂")
552
+
553
  cols = st.columns(2)
554
  with cols[0]:
555
  st.subheader(f"Camera 0 ({selected_cam0}) 🎬" if selected_cam0 else "Camera 0 (None Detected)")