riteshcp commited on
Commit
c231d41
·
verified ·
1 Parent(s): 65c2317

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import cv2
2
  import gradio as gr
 
3
 
4
  # Global variable to store the path of the uploaded video
5
  video_path = ""
@@ -7,6 +8,7 @@ video_path = ""
7
  def upload_video(uploaded_video):
8
  """
9
  Function to handle video upload and store the video path globally.
 
10
  """
11
  global video_path
12
  video_path = uploaded_video
@@ -42,7 +44,9 @@ def process_video():
42
  cap.release()
43
 
44
  if processed_frame is not None:
45
- return processed_frame
 
 
46
  else:
47
  return "No faces detected or video is empty."
48
 
 
1
  import cv2
2
  import gradio as gr
3
+ import os
4
 
5
  # Global variable to store the path of the uploaded video
6
  video_path = ""
 
8
  def upload_video(uploaded_video):
9
  """
10
  Function to handle video upload and store the video path globally.
11
+ The video is saved to the Hugging Face Space temporary directory.
12
  """
13
  global video_path
14
  video_path = uploaded_video
 
44
  cap.release()
45
 
46
  if processed_frame is not None:
47
+ output_path = os.path.join(os.getcwd(), "processed_frame.png")
48
+ cv2.imwrite(output_path, processed_frame)
49
+ return output_path
50
  else:
51
  return "No faces detected or video is empty."
52