David Driscoll commited on
Commit
4d52ef2
·
1 Parent(s): d4ac8c5

Update app

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -99,7 +99,7 @@ def analyze_faces(frame_rgb, output_frame):
99
 
100
  def analyze_webcam(video_path):
101
  """
102
- Receives a video file from the webcam, extracts one frame,
103
  then runs posture analysis, facial emotion detection, object detection,
104
  and face detection on that frame.
105
  Returns an annotated image and a textual summary.
@@ -115,7 +115,7 @@ def analyze_webcam(video_path):
115
  # Create a copy for drawing annotations
116
  output_frame = frame.copy()
117
 
118
- # Convert frame to RGB for certain analyses
119
  frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
120
 
121
  # Run analyses
@@ -146,10 +146,11 @@ def analyze_webcam(video_path):
146
  # Gradio Interface Setup
147
  # -----------------------------
148
 
149
- # Using gr.Video to capture webcam input in Gradio 5.x
 
150
  interface = gr.Interface(
151
  fn=analyze_webcam,
152
- inputs=gr.Video(source="webcam", streaming=True, label="Webcam Feed"),
153
  outputs=[
154
  gr.Image(type="numpy", label="Annotated Output"),
155
  gr.Textbox(label="Analysis Summary")
 
99
 
100
  def analyze_webcam(video_path):
101
  """
102
+ Receives a video file (captured from the webcam), extracts one frame,
103
  then runs posture analysis, facial emotion detection, object detection,
104
  and face detection on that frame.
105
  Returns an annotated image and a textual summary.
 
115
  # Create a copy for drawing annotations
116
  output_frame = frame.copy()
117
 
118
+ # Convert frame to RGB for some analyses
119
  frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
120
 
121
  # Run analyses
 
146
  # Gradio Interface Setup
147
  # -----------------------------
148
 
149
+ # Note: In the current version of Gradio, the Video component does not accept a 'source' argument.
150
+ # Remove the 'source' parameter. Streaming is still enabled.
151
  interface = gr.Interface(
152
  fn=analyze_webcam,
153
+ inputs=gr.Video(streaming=True, label="Webcam Feed"),
154
  outputs=[
155
  gr.Image(type="numpy", label="Annotated Output"),
156
  gr.Textbox(label="Analysis Summary")