CoolFace
Apppublic

giuinc78/sam3d-server

sourceHugging Faceupdated 10mo agoView on Hugging Face
0likes
App README

SAM3D HuggingFace Space - API only (All outputs) ===============================================

Contents:

  • Dockerfile
  • requirements.txt
  • server.py

How it works ------------

  • The Dockerfile installs system packages, Python requirements, then clones the SAM3D repository into /app/sam3d and adds it to PYTHONPATH.
  • server.py runs a FastAPI app on port 7860 exposing: GET /healthz POST /api/predict/ (multipart/form-data, field name 'file')

API usage example (curl) ------------------------ curl -X POST "https://huggingface.co/spaces/<user>/<space-name>/api/predict/" \ -F "file=@/path/to/image.jpg"

The response JSON can contain:

  • depthmapbase64: PNG image (base64)
  • mask_base64: PNG mask (base64)
  • meshobjbase64: OBJ file (base64)
  • pointcloudply_base64: PLY file (base64)
  • embedding: list of floats
  • raw: other outputs

Notes and caveats -----------------

  • The SAM3D repository's runtime API may differ; server.py uses defensive extraction logic and attempts to handle common tensor/array outputs. You may need to adapt key names depending on the exact SAM3D version / API.
  • For production or heavy usage, prefer running on a GPU-backed Space or external GPU host.
  • This package expects internet access at build/run time to download pretrained weights.