Spaces:
Sleeping
Sleeping
dillonlaird
commited on
Commit
•
fc50760
1
Parent(s):
bd37d1c
updated to new api
Browse files
app.py
CHANGED
@@ -3,7 +3,8 @@ import streamlit as st
|
|
3 |
|
4 |
from pathlib import Path
|
5 |
from landingai.predict import Predictor
|
6 |
-
from landingai.
|
|
|
7 |
from landingai.st_utils import render_svg
|
8 |
|
9 |
|
@@ -37,11 +38,12 @@ def get_latest_surfer_count():
|
|
37 |
for i, frame in enumerate(vid_src):
|
38 |
if i >= VIDEO_LEN_SEC * FPS:
|
39 |
break
|
40 |
-
frs.extend(frame
|
|
|
41 |
frs.save_video(str(VIDEO_CACHE_PATH), video_fps=FPS, image_src="overlay")
|
42 |
-
counts =
|
43 |
if "surfer" in counts:
|
44 |
-
surfers =
|
45 |
else:
|
46 |
surfers = 0
|
47 |
st.video(open(VIDEO_CACHE_PATH, "rb").read())
|
|
|
3 |
|
4 |
from pathlib import Path
|
5 |
from landingai.predict import Predictor
|
6 |
+
from landingai.pipeline.image_source import NetworkedCamera, FrameSet
|
7 |
+
from landingai.pipeline.postprocessing import get_class_counts
|
8 |
from landingai.st_utils import render_svg
|
9 |
|
10 |
|
|
|
38 |
for i, frame in enumerate(vid_src):
|
39 |
if i >= VIDEO_LEN_SEC * FPS:
|
40 |
break
|
41 |
+
frs.extend(frame)
|
42 |
+
frs.run_predict(predictor=surfer_model).overlay_predictions()
|
43 |
frs.save_video(str(VIDEO_CACHE_PATH), video_fps=FPS, image_src="overlay")
|
44 |
+
counts = get_class_counts(frs)
|
45 |
if "surfer" in counts:
|
46 |
+
surfers = counts["surfer"] / (VIDEO_LEN_SEC * FPS)
|
47 |
else:
|
48 |
surfers = 0
|
49 |
st.video(open(VIDEO_CACHE_PATH, "rb").read())
|