fcernafukuzaki commited on
Commit
1674e2f
·
verified ·
1 Parent(s): d04305d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -1,18 +1,18 @@
1
  import streamlit as st
2
  import cv2
3
- from ultralytics import YOLO
4
 
5
- model = YOLO('best.pt')
6
 
7
- def track(source):
8
- result = model.track(source=source)
9
- return result
10
 
11
  st.set_page_config(page_title="Streamlit WebCam App")
12
  st.title("Webcam Display Steamlit App")
13
  cap = cv2.VideoCapture(0)
14
  frame_placeholder = st.empty()
15
- st_frame = st.empty()
16
  stop_button_pressed = st.button("Stop")
17
  while cap.isOpened() and not stop_button_pressed:
18
  ret, frame = cap.read()
@@ -22,14 +22,14 @@ while cap.isOpened() and not stop_button_pressed:
22
  frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
23
  frame_placeholder.image(frame, channels="RGB")
24
 
25
- resultado = track(frame)
26
- res_plotted = resultado[0].plot()
27
 
28
- st_frame.image(res_plotted,
29
- caption='Detected Video',
30
- channels="RGB",
31
- #use_column_width=True
32
- )
33
 
34
  if cv2.waitKey(1) & 0xFF == ord("q") or stop_button_pressed:
35
  break
 
1
  import streamlit as st
2
  import cv2
3
+ #from ultralytics import YOLO
4
 
5
+ #model = YOLO('best.pt')
6
 
7
+ #def track(source):
8
+ # result = model.track(source=source)
9
+ # return result
10
 
11
  st.set_page_config(page_title="Streamlit WebCam App")
12
  st.title("Webcam Display Steamlit App")
13
  cap = cv2.VideoCapture(0)
14
  frame_placeholder = st.empty()
15
+ #st_frame = st.empty()
16
  stop_button_pressed = st.button("Stop")
17
  while cap.isOpened() and not stop_button_pressed:
18
  ret, frame = cap.read()
 
22
  frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
23
  frame_placeholder.image(frame, channels="RGB")
24
 
25
+ #resultado = track(frame)
26
+ #res_plotted = resultado[0].plot()
27
 
28
+ #st_frame.image(res_plotted,
29
+ # caption='Detected Video',
30
+ # channels="RGB",
31
+ # #use_column_width=True
32
+ # )
33
 
34
  if cv2.waitKey(1) & 0xFF == ord("q") or stop_button_pressed:
35
  break