jovian commited on
Commit
6fd7e13
·
1 Parent(s): fdfed4a
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -6,7 +6,7 @@ from sahi import AutoDetectionModel
6
  from PIL import Image
7
  import plotly.graph_objects as go
8
  import torch
9
- import spaces
10
 
11
  import os
12
  import shutil
@@ -105,7 +105,7 @@ class Detection:
105
  # Populate the category_areas dictionary
106
  for annotation in annotations:
107
  category_name = annotation['category_name']
108
- area = annotation['bbox'][2] * annotation['bbox'][3] # Width * Height
109
  if category_name in category_areas:
110
  category_areas[category_name].append(area)
111
 
@@ -217,7 +217,7 @@ def upload_image(image):
217
  """Process the uploaded image (if needed) and display it."""
218
  return image
219
 
220
- @spaces.GPU
221
  def apply_detection(image):
222
  """Run object detection on the uploaded image and return the annotated image."""
223
  # Convert image from PIL to NumPy array
 
6
  from PIL import Image
7
  import plotly.graph_objects as go
8
  import torch
9
+ #import spaces
10
 
11
  import os
12
  import shutil
 
105
  # Populate the category_areas dictionary
106
  for annotation in annotations:
107
  category_name = annotation['category_name']
108
+ area = annotation['area']
109
  if category_name in category_areas:
110
  category_areas[category_name].append(area)
111
 
 
217
  """Process the uploaded image (if needed) and display it."""
218
  return image
219
 
220
+ #@spaces.GPU
221
  def apply_detection(image):
222
  """Run object detection on the uploaded image and return the annotated image."""
223
  # Convert image from PIL to NumPy array