jovian commited on
Commit
f44f9bf
·
1 Parent(s): d77f8c0
Files changed (1) hide show
  1. app.py +5 -2
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
-
10
 
11
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
12
 
@@ -145,6 +145,9 @@ class Detection:
145
 
146
  return individual_graphs['Nicks'], individual_graphs['Dents'], individual_graphs['Scratches'], individual_graphs['Pittings']
147
 
 
 
 
148
 
149
 
150
  def generate_frequency_graph(self, annotations):
@@ -207,7 +210,7 @@ def upload_image(image):
207
  """Process the uploaded image (if needed) and display it."""
208
  return image
209
 
210
-
211
  def apply_detection(image):
212
  """Run object detection on the uploaded image and return the annotated image."""
213
  # 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
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
12
 
 
145
 
146
  return individual_graphs['Nicks'], individual_graphs['Dents'], individual_graphs['Scratches'], individual_graphs['Pittings']
147
 
148
+
149
+
150
+
151
 
152
 
153
  def generate_frequency_graph(self, annotations):
 
210
  """Process the uploaded image (if needed) and display it."""
211
  return image
212
 
213
+ @spaces.GPU
214
  def apply_detection(image):
215
  """Run object detection on the uploaded image and return the annotated image."""
216
  # Convert image from PIL to NumPy array