merve HF staff commited on
Commit
59ea794
1 Parent(s): abad12b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import torch
2
  import gradio as gr
3
  from transformers import Owlv2Processor, Owlv2ForObjectDetection
4
-
5
 
6
  # Use GPU if available
7
  if torch.cuda.is_available():
@@ -12,7 +12,7 @@ else:
12
  model = Owlv2ForObjectDetection.from_pretrained("google/owlv2-base-patch16-ensemble").to(device)
13
  processor = Owlv2Processor.from_pretrained("google/owlv2-base-patch16-ensemble")
14
 
15
-
16
  def query_image(img, text_queries, score_threshold):
17
  text_queries = text_queries
18
  text_queries = text_queries.split(",")
 
1
  import torch
2
  import gradio as gr
3
  from transformers import Owlv2Processor, Owlv2ForObjectDetection
4
+ import spaces
5
 
6
  # Use GPU if available
7
  if torch.cuda.is_available():
 
12
  model = Owlv2ForObjectDetection.from_pretrained("google/owlv2-base-patch16-ensemble").to(device)
13
  processor = Owlv2Processor.from_pretrained("google/owlv2-base-patch16-ensemble")
14
 
15
+ @spaces.GPU
16
  def query_image(img, text_queries, score_threshold):
17
  text_queries = text_queries
18
  text_queries = text_queries.split(",")