zdou0830 commited on
Commit
7f2ed69
1 Parent(s): a5c6f8e
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -78,6 +78,10 @@ def resize_image_by_width(image, new_width=500):
78
  def predict(image, text, ground_tokens=""):
79
  #image = resize_image_by_width(image)
80
  print(image.shape)
 
 
 
 
81
  ground_tokens = None if ground_tokens.strip() == "" else ground_tokens.strip().split(";")
82
  result, _ = glip_demo.run_on_web_image(deepcopy(image[:, :, [2, 1, 0]]), text, 0.5, ground_tokens, **athetics_params)
83
  fiber_result, _ = fiber_demo.run_on_web_image(deepcopy(image[:, :, [2, 1, 0]]), text, 0.5, ground_tokens, **athetics_params)
 
78
  def predict(image, text, ground_tokens=""):
79
  #image = resize_image_by_width(image)
80
  print(image.shape)
81
+ max_len = max(image.shape)
82
+ import math
83
+ athetics_params["text_size"] = math.ceil(max_len/1000)
84
+ athetics_params["text_pixel"] = math.ceil(max_len/1000*3)
85
  ground_tokens = None if ground_tokens.strip() == "" else ground_tokens.strip().split(";")
86
  result, _ = glip_demo.run_on_web_image(deepcopy(image[:, :, [2, 1, 0]]), text, 0.5, ground_tokens, **athetics_params)
87
  fiber_result, _ = fiber_demo.run_on_web_image(deepcopy(image[:, :, [2, 1, 0]]), text, 0.5, ground_tokens, **athetics_params)