Georg commited on
Commit
92da831
·
1 Parent(s): 5ba2faa

Prepare job build context

Browse files
Files changed (2) hide show
  1. deploy.sh +2 -4
  2. estimator.py +4 -1
deploy.sh CHANGED
@@ -330,9 +330,7 @@ echo "✓ Pushed to HuggingFace"
330
  echo ""
331
  echo "HuggingFace will now:"
332
  echo " 1. Pull base image from DockerHub (${IMAGE_NAME_L2}:${TAG})"
333
- echo " 2. Build CUDA extensions"
334
- echo " 3. Download model weights"
335
- echo " 4. Start the Gradio app"
336
  echo ""
337
 
338
  # Follow build logs
@@ -395,7 +393,7 @@ if [ -n "${HF_TOKEN}" ]; then
395
 
396
  echo ""
397
  echo "Following application logs for 1 minute..."
398
- LOG_URL="https://huggingface.co/api/spaces/${HF_SPACE}/logs"
399
  export LOG_URL
400
  python3 - <<'PY'
401
  import os
 
330
  echo ""
331
  echo "HuggingFace will now:"
332
  echo " 1. Pull base image from DockerHub (${IMAGE_NAME_L2}:${TAG})"
333
+ echo " 2. Start the Gradio app"
 
 
334
  echo ""
335
 
336
  # Follow build logs
 
393
 
394
  echo ""
395
  echo "Following application logs for 1 minute..."
396
+ LOG_URL="https://huggingface.co/api/spaces/${HF_SPACE}/logs/run"
397
  export LOG_URL
398
  python3 - <<'PY'
399
  import os
estimator.py CHANGED
@@ -5,6 +5,7 @@ This module wraps the FoundationPose library for 6D object pose estimation.
5
  """
6
 
7
  import logging
 
8
  import sys
9
  from pathlib import Path
10
  from typing import Dict, List, Optional
@@ -40,7 +41,7 @@ except ImportError as e:
40
  class FoundationPoseEstimator:
41
  """Wrapper for FoundationPose model."""
42
 
43
- def __init__(self, device: str = "cuda", weights_dir: str = "weights"):
44
  """Initialize FoundationPose estimator.
45
 
46
  Args:
@@ -48,6 +49,8 @@ class FoundationPoseEstimator:
48
  weights_dir: Directory containing model weights
49
  """
50
  self.device = device
 
 
51
  self.weights_dir = Path(weights_dir)
52
  self.registered_objects = {}
53
  self.scorer = None
 
5
  """
6
 
7
  import logging
8
+ import os
9
  import sys
10
  from pathlib import Path
11
  from typing import Dict, List, Optional
 
41
  class FoundationPoseEstimator:
42
  """Wrapper for FoundationPose model."""
43
 
44
+ def __init__(self, device: str = "cuda", weights_dir: str | None = None):
45
  """Initialize FoundationPose estimator.
46
 
47
  Args:
 
49
  weights_dir: Directory containing model weights
50
  """
51
  self.device = device
52
+ if weights_dir is None:
53
+ weights_dir = os.environ.get("FOUNDATIONPOSE_WEIGHTS_DIR", "/app/FoundationPose/weights")
54
  self.weights_dir = Path(weights_dir)
55
  self.registered_objects = {}
56
  self.scorer = None