ivoryzhang commited on
Commit
68efe72
·
1 Parent(s): ab40ac4

tweak label size

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. heinsight.py +3 -3
app.py CHANGED
@@ -10,7 +10,7 @@ import gradio as gr
10
  demo = gr.Interface(
11
  fn=heinsight.image_demo,
12
  inputs=[
13
- gr.Image(type="pil"),
14
  gr.Slider(0.1, 1.0, step=0.01, value=0, label="Cap Size Ratio")
15
  ],
16
  outputs=[
 
10
  demo = gr.Interface(
11
  fn=heinsight.image_demo,
12
  inputs=[
13
+ gr.Image(type="pil", label="Single Vessel Image"),
14
  gr.Slider(0.1, 1.0, step=0.01, value=0, label="Cap Size Ratio")
15
  ],
16
  outputs=[
heinsight.py CHANGED
@@ -201,10 +201,10 @@ class HeinSight:
201
  return output, raw_value
202
 
203
  @staticmethod
204
- def _get_dynamic_font_params(img_height, base_height=200, base_font_scale=0.5, base_thickness=1):
205
  scale_factor = img_height / base_height
206
  font_scale = base_font_scale * scale_factor
207
- thickness = max(1, int(base_thickness * scale_factor))
208
  return font_scale, thickness
209
 
210
  def draw_bounding_boxes(self, image, bboxes, class_names, thickness=None, text_right=False, on_raw=False):
@@ -213,7 +213,7 @@ class HeinSight:
213
  height = image.shape[1]
214
  font_scale, text_thickness = self._get_dynamic_font_params(height)
215
  margin = 2
216
- thickness = thickness or max(1, int(height / 200))
217
  for rect in bboxes:
218
  x1, y1, x2, y2, _, class_id = map(int, rect)
219
  class_name = class_names[class_id]
 
201
  return output, raw_value
202
 
203
  @staticmethod
204
+ def _get_dynamic_font_params(img_height, base_height=200, base_font_scale=1, base_thickness=2):
205
  scale_factor = img_height / base_height
206
  font_scale = base_font_scale * scale_factor
207
+ thickness = max(2, int(base_thickness * scale_factor))
208
  return font_scale, thickness
209
 
210
  def draw_bounding_boxes(self, image, bboxes, class_names, thickness=None, text_right=False, on_raw=False):
 
213
  height = image.shape[1]
214
  font_scale, text_thickness = self._get_dynamic_font_params(height)
215
  margin = 2
216
+ thickness = thickness or max(2, int(height / 200))
217
  for rect in bboxes:
218
  x1, y1, x2, y2, _, class_id = map(int, rect)
219
  class_name = class_names[class_id]