webolavo commited on
Commit
5cd54e2
·
verified ·
1 Parent(s): 6de7638

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -3
app.py CHANGED
@@ -20,7 +20,6 @@ TEXT_PROMPT = (
20
  "woman . man . young child . baby . female hand . male hand . "
21
  "female belly . male belly . female leg . male leg"
22
  )
23
- PROMPT_LABELS = [part.strip() for part in TEXT_PROMPT.split(".") if part.strip()]
24
  BOX_THRESHOLD = 0.25
25
  TEXT_THRESHOLD = 0.35
26
  NMS_IOU_THRESHOLD = 0.50
@@ -144,10 +143,9 @@ def run_detection(image: Image.Image) -> List[Dict[str, Any]]:
144
  if processor is None or model is None:
145
  raise RuntimeError("The model is not ready.")
146
 
147
- # Transformers 5 expects one list of candidate labels per input image.
148
  inputs = processor(
149
  images=image,
150
- text=[PROMPT_LABELS],
151
  return_tensors="pt",
152
  ).to(DEVICE)
153
  with torch.inference_mode():
 
20
  "woman . man . young child . baby . female hand . male hand . "
21
  "female belly . male belly . female leg . male leg"
22
  )
 
23
  BOX_THRESHOLD = 0.25
24
  TEXT_THRESHOLD = 0.35
25
  NMS_IOU_THRESHOLD = 0.50
 
143
  if processor is None or model is None:
144
  raise RuntimeError("The model is not ready.")
145
 
 
146
  inputs = processor(
147
  images=image,
148
+ text=TEXT_PROMPT,
149
  return_tensors="pt",
150
  ).to(DEVICE)
151
  with torch.inference_mode():