ElodieA commited on
Commit
55ef481
·
verified ·
1 Parent(s): f58a466

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -61,7 +61,7 @@ def process_video(video_file):
61
  for i, box in enumerate(boxes):
62
  class_id = int(class_ids[i])
63
  confidence = confidences[i]
64
- insect_id = int(box.id[0]) # Ensure the ID is an integer
65
 
66
  # Append detection data to DataFrame
67
  new_row = pd.DataFrame({
@@ -132,5 +132,5 @@ outputs = [
132
  gr.File(label="Download CSV")
133
  ]
134
 
135
- gr.Interface(fn=process_video, inputs=inputs, outputs=outputs, examples=[example_video]).launch()
136
 
 
61
  for i, box in enumerate(boxes):
62
  class_id = int(class_ids[i])
63
  confidence = confidences[i]
64
+ insect_id = int(box.id[0]) if box.id is not None else -1 # Use -1 if ID is not available
65
 
66
  # Append detection data to DataFrame
67
  new_row = pd.DataFrame({
 
132
  gr.File(label="Download CSV")
133
  ]
134
 
135
+ gr.Interface(fn=process_video, inputs=inputs, outputs=outputs, title="InsectSpy Automated Insect Detection", examples=[example_video]).launch()
136