liuyizhang commited on
Commit
57ec633
1 Parent(s): a71406a

update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -185,6 +185,8 @@ device = "cuda"
185
 
186
  device = get_device()
187
 
 
 
188
  # initialize groundingdino model
189
  groundingdino_model = load_model_hf(config_file, ckpt_repo_id, ckpt_filenmae)
190
 
@@ -194,7 +196,7 @@ sam_predictor = SamPredictor(build_sam(checkpoint=sam_checkpoint))
194
  # initialize stable-diffusion-inpainting
195
  sd_pipe = StableDiffusionInpaintPipeline.from_pretrained(
196
  "runwayml/stable-diffusion-inpainting",
197
- # torch_dtype=torch.float16
198
  )
199
  sd_pipe = sd_pipe.to(device)
200
 
@@ -211,7 +213,7 @@ def run_grounded_sam(image_path, text_prompt, task_type, inpaint_prompt, box_thr
211
 
212
  # run grounding dino model
213
  boxes_filt, pred_phrases = get_grounding_output(
214
- groundingdino_model, image, text_prompt, box_threshold, text_threshold, device=device
215
  )
216
 
217
  size = image_pil.size
 
185
 
186
  device = get_device()
187
 
188
+ print(f'device={device}')
189
+
190
  # initialize groundingdino model
191
  groundingdino_model = load_model_hf(config_file, ckpt_repo_id, ckpt_filenmae)
192
 
 
196
  # initialize stable-diffusion-inpainting
197
  sd_pipe = StableDiffusionInpaintPipeline.from_pretrained(
198
  "runwayml/stable-diffusion-inpainting",
199
+ torch_dtype=torch.float16
200
  )
201
  sd_pipe = sd_pipe.to(device)
202
 
 
213
 
214
  # run grounding dino model
215
  boxes_filt, pred_phrases = get_grounding_output(
216
+ groundingdino_model, image, text_prompt, box_threshold, text_threshold, device='cpu'
217
  )
218
 
219
  size = image_pil.size