SunilS commited on
Commit ·
d94398e
1
Parent(s): 97d98ee
Perf: Optimize Streamlit video processing loop with JPEG encoding
Browse files
app.py
CHANGED
|
@@ -588,8 +588,7 @@ elif app_mode =='Run on Test Videos':
|
|
| 588 |
window.append(frame)
|
| 589 |
# kpi1_text.write(f"<h1 style='text-align: center; color: red;'>{idx+1}/{current_test_df.shape[0]}</h1>", unsafe_allow_html=True)
|
| 590 |
# kpi2_text.write(f"<h1 style='text-align: center; color: red;'>--</h1>", unsafe_allow_html=True)
|
| 591 |
-
|
| 592 |
-
st.image(canvas_with_plot,channels = 'BGR',use_column_width=True)
|
| 593 |
else:
|
| 594 |
|
| 595 |
window[:-1] = window[1:]
|
|
@@ -663,8 +662,7 @@ elif app_mode =='Run on Test Videos':
|
|
| 663 |
# st.bar_chart(df)
|
| 664 |
# frame = cv2.resize(frame,(0,0),fx = 0.8 , fy = 0.8)
|
| 665 |
# frame = image_resize(image = frame, width = 640)
|
| 666 |
-
|
| 667 |
-
st.image(canvas_with_plot,channels = 'BGR',use_column_width=True)
|
| 668 |
|
| 669 |
idx=idx+1
|
| 670 |
|
|
|
|
| 588 |
window.append(frame)
|
| 589 |
# kpi1_text.write(f"<h1 style='text-align: center; color: red;'>{idx+1}/{current_test_df.shape[0]}</h1>", unsafe_allow_html=True)
|
| 590 |
# kpi2_text.write(f"<h1 style='text-align: center; color: red;'>--</h1>", unsafe_allow_html=True)
|
| 591 |
+
view.image(cv2.imencode('.jpg', canvas_with_plot)[1].tobytes(), use_column_width=True)
|
|
|
|
| 592 |
else:
|
| 593 |
|
| 594 |
window[:-1] = window[1:]
|
|
|
|
| 662 |
# st.bar_chart(df)
|
| 663 |
# frame = cv2.resize(frame,(0,0),fx = 0.8 , fy = 0.8)
|
| 664 |
# frame = image_resize(image = frame, width = 640)
|
| 665 |
+
view.image(cv2.imencode('.jpg', canvas_with_plot)[1].tobytes(), use_column_width=True)
|
|
|
|
| 666 |
|
| 667 |
idx=idx+1
|
| 668 |
|