KillD00zer commited on
Commit
c8e9946
·
verified ·
1 Parent(s): f68e74f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -11
app.py CHANGED
@@ -4,18 +4,20 @@ import tempfile
4
  from Fight_detec_func import fight_detec
5
  from objec_detect_yolo import detection
6
 
7
- def analyze_video(video_file):
8
- # Save uploaded file to temp location
9
- def analyze_video(video_file):
10
  temp_dir = "/tmp"
11
- video_path = os.path.join(temp_dir, os.path.basename(video_file)) # ✅ fix
12
-
13
- with open(video_path, 'wb') as f:
14
- f.write(video_file.read())
15
-
16
- # Run both detection functions
17
- fight_result = fight_detec(video_path, debug=False)
18
- yolo_result = detection(video_path)
 
 
 
 
19
 
20
  # Clean up
21
  os.remove(video_path)
 
4
  from Fight_detec_func import fight_detec
5
  from objec_detect_yolo import detection
6
 
7
+ def analyze_video(video_path):
 
 
8
  temp_dir = "/tmp"
9
+ output_path = os.path.join(temp_dir, "output.mp4")
10
+
11
+ # Call your fight and object detection functions
12
+ fight_result = fight_detection(video_path)
13
+ crime_result, annotated_video_path = Crime(video_path)
14
+
15
+ return {
16
+ "Fight": fight_result,
17
+ "Crime": crime_result,
18
+ "Output Video": annotated_video_path
19
+ }
20
+
21
 
22
  # Clean up
23
  os.remove(video_path)