markany-yhkwon commited on
Commit
5bccb37
·
1 Parent(s): f09727f
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  import argparse
2
  from functools import partial
3
  import cv2
@@ -7,17 +10,14 @@ from io import BytesIO
7
  from PIL import Image
8
  import numpy as np
9
  from pathlib import Path
10
- import gradio as gr
11
 
12
  import warnings
13
 
14
  import torch
15
 
16
- os.system("python setup.py build develop --user")
17
- os.system("pip install packaging==21.3")
18
  warnings.filterwarnings("ignore")
19
 
20
-
21
  from groundingdino.models import build_model
22
  from groundingdino.util.slconfig import SLConfig
23
  from groundingdino.util.utils import clean_state_dict
@@ -63,6 +63,7 @@ def image_transform_grounding_for_vis(init_image):
63
 
64
  model = load_model_hf(config_file, ckpt_repo_id, ckpt_filenmae)
65
 
 
66
  def run_grounding(input_image, grounding_caption, box_threshold, text_threshold):
67
  init_image = input_image.convert("RGB")
68
  original_size = init_image.size
 
1
+ import gradio as gr
2
+ import spaces
3
+
4
  import argparse
5
  from functools import partial
6
  import cv2
 
10
  from PIL import Image
11
  import numpy as np
12
  from pathlib import Path
13
+
14
 
15
  import warnings
16
 
17
  import torch
18
 
 
 
19
  warnings.filterwarnings("ignore")
20
 
 
21
  from groundingdino.models import build_model
22
  from groundingdino.util.slconfig import SLConfig
23
  from groundingdino.util.utils import clean_state_dict
 
63
 
64
  model = load_model_hf(config_file, ckpt_repo_id, ckpt_filenmae)
65
 
66
+ @spaces.GPU
67
  def run_grounding(input_image, grounding_caption, box_threshold, text_threshold):
68
  init_image = input_image.convert("RGB")
69
  original_size = init_image.size