Spaces:
Runtime error
Runtime error
NassimeBejaia
commited on
Commit
•
e88ad6a
1
Parent(s):
49a40ea
Update app.py
Browse files
app.py
CHANGED
@@ -33,7 +33,7 @@ def load_model():
|
|
33 |
|
34 |
# Ft saving uploaded video to directory
|
35 |
def save_uploaded_vid(uploadedfile):
|
36 |
-
with open(os.path.join("data", uploadedfile.name),"wb") as f:
|
37 |
f.write(uploadedfile.getbuffer())
|
38 |
return st.success("Video saved in data dir ")
|
39 |
|
@@ -89,8 +89,8 @@ def prediction(vname):
|
|
89 |
st.write('start prediction')
|
90 |
st.write(os.listdir('test_detection/deep_sort_pytorch/configs/'))
|
91 |
os.system("python test_detection/track.py --yolo_weights test_detection/yolov5/weights/crowdhuman_yolov5m.pt --img 352 --save-vid --save-txt --classes 1 --conf-thres 0.4 --source " + vpath)
|
92 |
-
os.system("ffmpeg -i
|
93 |
-
path = '
|
94 |
if os.path.exists(path):
|
95 |
video_file = open(path, 'rb')
|
96 |
video_bytes = video_file.read()
|
|
|
33 |
|
34 |
# Ft saving uploaded video to directory
|
35 |
def save_uploaded_vid(uploadedfile):
|
36 |
+
with open(os.path.join("test_detection/data", uploadedfile.name),"wb") as f:
|
37 |
f.write(uploadedfile.getbuffer())
|
38 |
return st.success("Video saved in data dir ")
|
39 |
|
|
|
89 |
st.write('start prediction')
|
90 |
st.write(os.listdir('test_detection/deep_sort_pytorch/configs/'))
|
91 |
os.system("python test_detection/track.py --yolo_weights test_detection/yolov5/weights/crowdhuman_yolov5m.pt --img 352 --save-vid --save-txt --classes 1 --conf-thres 0.4 --source " + vpath)
|
92 |
+
os.system("ffmpeg -i inference/output/"+vname + " -vcodec libx264 -y inference/output/output_video.mp4")
|
93 |
+
path = 'inference/output/output_video.mp4'
|
94 |
if os.path.exists(path):
|
95 |
video_file = open(path, 'rb')
|
96 |
video_bytes = video_file.read()
|