SynLayers commited on
Commit
8beae9c
·
verified ·
1 Parent(s): 4a1eae7

Upload demo/infer/run_caption_bbox_infer.py with huggingface_hub

Browse files
demo/infer/run_caption_bbox_infer.py CHANGED
@@ -21,14 +21,21 @@ except ImportError:
21
  )
22
 
23
  PROJECT_ROOT = Path(__file__).resolve().parents[2]
24
- DEFAULT_MODEL_REPO_ID = "SynLayers/Bbox-caption-8b"
25
 
26
 
27
  def resolve_default_bbox_model() -> str:
28
- env_path = os.environ.get("SYNLAYERS_BBOX_MODEL") or os.environ.get("SYNLAYERS_MODEL_REPO")
29
- if env_path and Path(env_path).exists():
30
- return str(Path(env_path))
31
- return env_path or DEFAULT_MODEL_REPO_ID
 
 
 
 
 
 
 
 
32
 
33
 
34
  CAPTION_BBOX_PROMPT_TOP_LEFT = (
 
21
  )
22
 
23
  PROJECT_ROOT = Path(__file__).resolve().parents[2]
 
24
 
25
 
26
  def resolve_default_bbox_model() -> str:
27
+ env_model = os.environ.get("SYNLAYERS_BBOX_MODEL") or os.environ.get("SYNLAYERS_BBOX_MODEL_REPO")
28
+ if env_model:
29
+ return env_model
30
+
31
+ candidates = [
32
+ PROJECT_ROOT if (PROJECT_ROOT / "config.json").exists() and (PROJECT_ROOT / "tokenizer_config.json").exists() else None,
33
+ PROJECT_ROOT / "Bbox-caption-8b",
34
+ ]
35
+ for candidate in candidates:
36
+ if candidate and candidate.exists():
37
+ return str(candidate)
38
+ return "SynLayers/Bbox-caption-8b"
39
 
40
 
41
  CAPTION_BBOX_PROMPT_TOP_LEFT = (