zdou0830 commited on
Commit
fd60bd4
1 Parent(s): 5732a50
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -65,6 +65,8 @@ glip_demo = GLIPDemo(
65
 
66
  config_file = "configs/pretrain_new/desco_fiber.yaml"
67
  weight_file = "MODEL/desco_fiber_base.pth"
 
 
68
  cfg.merge_from_file(config_file)
69
  cfg.merge_from_list(["MODEL.WEIGHT", weight_file])
70
  cfg.merge_from_list(["MODEL.DEVICE", "cuda"])
@@ -80,7 +82,6 @@ def predict(image, text, specified_tokens=""):
80
  specified_tokens = None
81
  else:
82
  specified_tokens = specified_tokens.strip().split(";")
83
- from copy import deepcopy
84
  result, _ = glip_demo.run_on_web_image(deepcopy(image[:, :, [2, 1, 0]]), text, 0.5, specified_tokens)
85
  fiber_result, _ = fiber_demo.run_on_web_image(deepcopy(image[:, :, [2, 1, 0]]), text, 0.5, specified_tokens)
86
  return result[:, :, [2, 1, 0]], fiber_result[:, :, [2, 1, 0]]
 
65
 
66
  config_file = "configs/pretrain_new/desco_fiber.yaml"
67
  weight_file = "MODEL/desco_fiber_base.pth"
68
+ from copy import deepcopy
69
+ cfg = deepcopy(cfg)
70
  cfg.merge_from_file(config_file)
71
  cfg.merge_from_list(["MODEL.WEIGHT", weight_file])
72
  cfg.merge_from_list(["MODEL.DEVICE", "cuda"])
 
82
  specified_tokens = None
83
  else:
84
  specified_tokens = specified_tokens.strip().split(";")
 
85
  result, _ = glip_demo.run_on_web_image(deepcopy(image[:, :, [2, 1, 0]]), text, 0.5, specified_tokens)
86
  fiber_result, _ = fiber_demo.run_on_web_image(deepcopy(image[:, :, [2, 1, 0]]), text, 0.5, specified_tokens)
87
  return result[:, :, [2, 1, 0]], fiber_result[:, :, [2, 1, 0]]