Rammohan0504 commited on
Commit
6b23de6
·
verified ·
1 Parent(s): 420f765

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -84,9 +84,15 @@ def build_table(title, rows):
84
  return html
85
 
86
  # Analyzing video for health metrics
87
- def analyze_video(video_path):
88
- import matplotlib.pyplot as plt
89
- cap = cv2.VideoCapture(video_path)
 
 
 
 
 
 
90
  brightness_vals = []
91
  green_vals = []
92
  frame_sample = None
 
84
  return html
85
 
86
  # Analyzing video for health metrics
87
+ def analyze_video(video):
88
+ # If video is passed as a path, open it using OpenCV
89
+ if isinstance(video, str):
90
+ cap = cv2.VideoCapture(video)
91
+ else:
92
+ # If video is passed as a numpy array, treat it as an in-memory video
93
+ cap = cv2.VideoCapture()
94
+ cap.open(video)
95
+
96
  brightness_vals = []
97
  green_vals = []
98
  frame_sample = None