CosmickVisions commited on
Commit
6dc88fc
·
verified ·
1 Parent(s): 28ab601

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -8
app.py CHANGED
@@ -1886,6 +1886,15 @@ def main():
1886
  track_update_frames = 5
1887
  confidence_threshold = 0.5
1888
 
 
 
 
 
 
 
 
 
 
1889
  # Mode-specific parameters
1890
  if processing_mode == "Google Vision API Only" or processing_mode == "Hybrid (Google Vision + OpenCV)":
1891
  # Google Vision parameters
@@ -2016,20 +2025,33 @@ def main():
2016
  else:
2017
  with st.spinner(f"Processing video with {processing_mode} mode (max 10 seconds)..."):
2018
  try:
2019
- # Create a dict of processing parameters to pass to the processing function
2020
  processing_params = {
2021
  "processing_mode": processing_mode,
2022
  "track_update_frames": track_update_frames,
2023
  "confidence_threshold": confidence_threshold,
2024
- "vision_update_interval": vision_update_interval,
2025
- "max_results": max_results,
2026
- "enable_face_landmarks": enable_face_landmarks,
2027
- "tracking_algorithm": tracking_algorithm,
2028
- "motion_sensitivity": motion_sensitivity,
2029
- "prioritize_vision": prioritize_vision,
2030
- "blend_results": blend_results
2031
  }
2032
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2033
  # Process the video with the parameters
2034
  processed_video, results = process_video_file(uploaded_file, analysis_types, **processing_params)
2035
 
 
1886
  track_update_frames = 5
1887
  confidence_threshold = 0.5
1888
 
1889
+ # Initialize variables with default values
1890
+ vision_update_interval = 1.0
1891
+ max_results = 10
1892
+ enable_face_landmarks = True
1893
+ tracking_algorithm = "KCF"
1894
+ motion_sensitivity = 32
1895
+ prioritize_vision = "Google Vision (more accurate)"
1896
+ blend_results = True
1897
+
1898
  # Mode-specific parameters
1899
  if processing_mode == "Google Vision API Only" or processing_mode == "Hybrid (Google Vision + OpenCV)":
1900
  # Google Vision parameters
 
2025
  else:
2026
  with st.spinner(f"Processing video with {processing_mode} mode (max 10 seconds)..."):
2027
  try:
2028
+ # Create a base dict with common parameters
2029
  processing_params = {
2030
  "processing_mode": processing_mode,
2031
  "track_update_frames": track_update_frames,
2032
  "confidence_threshold": confidence_threshold,
 
 
 
 
 
 
 
2033
  }
2034
 
2035
+ # Add mode-specific parameters
2036
+ if processing_mode == "Google Vision API Only" or processing_mode == "Hybrid (Google Vision + OpenCV)":
2037
+ processing_params.update({
2038
+ "vision_update_interval": vision_update_interval,
2039
+ "max_results": max_results,
2040
+ "enable_face_landmarks": enable_face_landmarks
2041
+ })
2042
+
2043
+ if processing_mode == "OpenCV Only" or processing_mode == "Hybrid (Google Vision + OpenCV)":
2044
+ processing_params.update({
2045
+ "tracking_algorithm": tracking_algorithm,
2046
+ "motion_sensitivity": motion_sensitivity
2047
+ })
2048
+
2049
+ if processing_mode == "Hybrid (Google Vision + OpenCV)":
2050
+ processing_params.update({
2051
+ "prioritize_vision": prioritize_vision == "Google Vision (more accurate)",
2052
+ "blend_results": blend_results
2053
+ })
2054
+
2055
  # Process the video with the parameters
2056
  processed_video, results = process_video_file(uploaded_file, analysis_types, **processing_params)
2057