Subh775 commited on
Commit
9994b0e
·
verified ·
1 Parent(s): 44faee7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -20,7 +20,7 @@ except Exception as e:
20
  app = Flask(__name__, static_folder="static", static_url_path="/")
21
 
22
  # HF checkpoint raw resolve URL (use the 'resolve/main' raw link)
23
- CHECKPOINT_URL = "https://huggingface.co/Subh775/Segment-Tulsi-TFs-2/resolve/main/checkpoint_best_total.pth"
24
  CHECKPOINT_PATH = os.path.join("/tmp", "checkpoint_best_total.pth")
25
 
26
  MODEL_LOCK = threading.Lock()
@@ -79,7 +79,7 @@ def encode_pil_to_dataurl(pil_img: Image.Image, fmt="PNG"):
79
  b = base64.b64encode(buf.getvalue()).decode("ascii")
80
  return f"data:image/{fmt.lower()};base64,{b}"
81
 
82
- def overlay_mask_on_image(pil_img: Image.Image, masks, confidences, threshold=0.25, mask_color=(255,77,166), alpha=0.45):
83
  """
84
  masks: either list of HxW bool arrays or numpy array (N,H,W)
85
  confidences: list of floats
 
20
  app = Flask(__name__, static_folder="static", static_url_path="/")
21
 
22
  # HF checkpoint raw resolve URL (use the 'resolve/main' raw link)
23
+ CHECKPOINT_URL = "https://huggingface.co/Subh775/Segment-Tulsi-TFs-3/resolve/main/checkpoint_best_total.pth"
24
  CHECKPOINT_PATH = os.path.join("/tmp", "checkpoint_best_total.pth")
25
 
26
  MODEL_LOCK = threading.Lock()
 
79
  b = base64.b64encode(buf.getvalue()).decode("ascii")
80
  return f"data:image/{fmt.lower()};base64,{b}"
81
 
82
+ def overlay_mask_on_image(pil_img: Image.Image, masks, confidences, threshold=0.01, mask_color=(255,77,166), alpha=0.45):
83
  """
84
  masks: either list of HxW bool arrays or numpy array (N,H,W)
85
  confidences: list of floats