Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import streamlit as st
|
2 |
from prediction import smartcities
|
3 |
|
@@ -6,7 +7,11 @@ st.header("Smart City Cars and Bikes detection")
|
|
6 |
st.markdown("Upload a video or select the example")
|
7 |
|
8 |
## Select video to inference
|
9 |
-
|
|
|
|
|
|
|
|
|
10 |
if st.button("example"):
|
11 |
file_video = "test_video.mp4"
|
12 |
|
@@ -19,9 +24,9 @@ if file_video is not None:
|
|
19 |
if output is not None:
|
20 |
with col1:
|
21 |
st.subheader("Input: ")
|
22 |
-
|
23 |
# video_bytes = video.read()
|
24 |
-
|
25 |
# st.video(video_bytes)
|
26 |
with col2:
|
27 |
st.subheader("Output: ")
|
|
|
1 |
+
import tempfile
|
2 |
import streamlit as st
|
3 |
from prediction import smartcities
|
4 |
|
|
|
7 |
st.markdown("Upload a video or select the example")
|
8 |
|
9 |
## Select video to inference
|
10 |
+
f = st.file_uploader(" Upload a video ", type=["mp4"])
|
11 |
+
tfile = tempfile.NamedTemporaryFile(delete=False)
|
12 |
+
tfile.write(f.read())
|
13 |
+
file_video = tfile.name
|
14 |
+
|
15 |
if st.button("example"):
|
16 |
file_video = "test_video.mp4"
|
17 |
|
|
|
24 |
if output is not None:
|
25 |
with col1:
|
26 |
st.subheader("Input: ")
|
27 |
+
video = open(file_video, "wb")
|
28 |
# video_bytes = video.read()
|
29 |
+
st.video(video, format="video/mp4")
|
30 |
# st.video(video_bytes)
|
31 |
with col2:
|
32 |
st.subheader("Output: ")
|