Pranavadhar commited on
Commit
2803fa0
1 Parent(s): 800ba0c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -6
app.py CHANGED
@@ -1,9 +1,9 @@
1
  import cv2
2
  import numpy as np
3
  import datetime
4
- import matplotlib.pyplot as plt
5
  import gradio as gr
6
 
 
7
  net = cv2.dnn.readNet("yolov3.weights", "yolov3.cfg")
8
  layer_names = net.getLayerNames()
9
  output_layers = [layer_names[i - 1] for i in net.getUnconnectedOutLayers()]
@@ -43,11 +43,6 @@ def detect_objects(image):
43
 
44
  return [(boxes[i], class_ids[i], confidences[i]) for i in range(len(boxes)) if i in indexes]
45
 
46
- def capture_frame(frame):
47
- current_time = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
48
- cv2.imwrite(f"captured_frame_{current_time}.jpg", frame)
49
- print(f"Captured frame saved as 'captured_frame_{current_time}.jpg'")
50
-
51
  def process_image(image):
52
  image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
53
  detections = detect_objects(image)
 
1
  import cv2
2
  import numpy as np
3
  import datetime
 
4
  import gradio as gr
5
 
6
+ # Ensure these files are available in the Hugging Face Space working directory
7
  net = cv2.dnn.readNet("yolov3.weights", "yolov3.cfg")
8
  layer_names = net.getLayerNames()
9
  output_layers = [layer_names[i - 1] for i in net.getUnconnectedOutLayers()]
 
43
 
44
  return [(boxes[i], class_ids[i], confidences[i]) for i in range(len(boxes)) if i in indexes]
45
 
 
 
 
 
 
46
  def process_image(image):
47
  image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
48
  detections = detect_objects(image)