ezamorag commited on
Commit
59478ea
·
1 Parent(s): 244c94f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -144,11 +144,12 @@ def testing_directcounter(input_img):
144
  countings = response['countings_scinames']
145
  img, text = display_detectionsandcountings_directcounter(input_img, countings, prob_th=0, cth = 0)
146
  return img, text
147
-
 
148
  def extractframes(vid_path):
149
  clip = VideoFileClip(vid_path)
150
- clip = clip.subclip(0, 10)
151
- stride = int(round(clip.fps,0))/2
152
  frames = []
153
  for i,frame in enumerate(clip.iter_frames()):
154
  if i % stride == 0:
@@ -170,7 +171,9 @@ def video_identity(video):
170
  vidupload2aws(video)
171
  video = processvideo(video, detector = testing_yolocounter)
172
  return video
 
173
 
 
174
  with gr.Blocks() as demo:
175
  gr.Markdown("Submit an image with insects in a trap")
176
 
@@ -188,7 +191,7 @@ with gr.Blocks() as demo:
188
  #button2 = gr.Button("Submit")
189
  button1.click(testing_yolocounter, input1, output2)
190
 
191
- with gr.Tab("Procesing on a video ...under development!"):
192
  with gr.Row():
193
  input3 = gr.Video()
194
  output3 = gr.Video()
 
144
  countings = response['countings_scinames']
145
  img, text = display_detectionsandcountings_directcounter(input_img, countings, prob_th=0, cth = 0)
146
  return img, text
147
+
148
+ #------------------------------------------------
149
  def extractframes(vid_path):
150
  clip = VideoFileClip(vid_path)
151
+ clip = clip.subclip(0, 10) #Cut first 10 seconds
152
+ stride = int(round(clip.fps,0))/2 #Subsample 2 fps
153
  frames = []
154
  for i,frame in enumerate(clip.iter_frames()):
155
  if i % stride == 0:
 
171
  vidupload2aws(video)
172
  video = processvideo(video, detector = testing_yolocounter)
173
  return video
174
+ #-------------------------------------------------
175
 
176
+
177
  with gr.Blocks() as demo:
178
  gr.Markdown("Submit an image with insects in a trap")
179
 
 
191
  #button2 = gr.Button("Submit")
192
  button1.click(testing_yolocounter, input1, output2)
193
 
194
+ with gr.Tab("Procesing on a video (under development)"):
195
  with gr.Row():
196
  input3 = gr.Video()
197
  output3 = gr.Video()