fcernafukuzaki commited on
Commit
81c2b6a
·
verified ·
1 Parent(s): 3c8f268

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -10,6 +10,9 @@ VIDEOS_DICT = {
10
  'video_1': 'IMG_0559.mov',
11
  }
12
 
 
 
 
13
  # Your videos will start appearing inside streamlit webapp 'Choose a video'.
14
 
15
  # Define the Gradio interface
@@ -42,11 +45,11 @@ def _display_detected_frames(conf, model, st_count, st_frame, image):
42
 
43
  inText = 'Vehicle In'
44
  outText = 'Vehicle Out'
45
- if config.OBJECT_COUNTER1 != None:
46
- for _, (key, value) in enumerate(config.OBJECT_COUNTER1.items()):
47
  inText += ' - ' + str(key) + ": " +str(value)
48
- if config.OBJECT_COUNTER != None:
49
- for _, (key, value) in enumerate(config.OBJECT_COUNTER.items()):
50
  outText += ' - ' + str(key) + ": " +str(value)
51
 
52
  # Plot the detected objects on the video frame
@@ -79,8 +82,8 @@ def infer_uploaded_video(conf, model):
79
  if st.button("Execution"):
80
  with st.spinner("Running..."):
81
  try:
82
- config.OBJECT_COUNTER1 = None
83
- config.OBJECT_COUNTER = None
84
  tfile = tempfile.NamedTemporaryFile()
85
  tfile.write(source_video.read())
86
  vid_cap = cv2.VideoCapture(
 
10
  'video_1': 'IMG_0559.mov',
11
  }
12
 
13
+ OBJECT_COUNTER = None
14
+ OBJECT_COUNTER1 = None
15
+
16
  # Your videos will start appearing inside streamlit webapp 'Choose a video'.
17
 
18
  # Define the Gradio interface
 
45
 
46
  inText = 'Vehicle In'
47
  outText = 'Vehicle Out'
48
+ if OBJECT_COUNTER1 != None:
49
+ for _, (key, value) in enumerate(OBJECT_COUNTER1.items()):
50
  inText += ' - ' + str(key) + ": " +str(value)
51
+ if OBJECT_COUNTER != None:
52
+ for _, (key, value) in enumerate(OBJECT_COUNTER.items()):
53
  outText += ' - ' + str(key) + ": " +str(value)
54
 
55
  # Plot the detected objects on the video frame
 
82
  if st.button("Execution"):
83
  with st.spinner("Running..."):
84
  try:
85
+ OBJECT_COUNTER1 = None
86
+ OBJECT_COUNTER = None
87
  tfile = tempfile.NamedTemporaryFile()
88
  tfile.write(source_video.read())
89
  vid_cap = cv2.VideoCapture(