Skip to content

Modernize PointOfFocus for production deployment - #3

Merged
ibrahimjspy merged 1 commit into
mainfrom
feature/optimisations
Jul 14, 2026
Merged

Modernize PointOfFocus for production deployment#3
ibrahimjspy merged 1 commit into
mainfrom
feature/optimisations

Conversation

@ibrahimjspy

Copy link
Copy Markdown
Owner

Summary

  • Refactors the service into a testable Flask app factory with typed errors, resource limits, and correct HTTP status codes (404/405 no longer masked as 500).
  • Upgrades runtime deps (Flask 3.1, OpenCV 4.13 headless, NumPy 2.x, requests, gunicorn) and hardens Docker with health checks, non-root user, and Gunicorn tuning.
  • Adds pytest suite (33 tests, ~89% coverage), ruff linting, and GitHub Actions CI.
  • Extends /focus with algorithm selection, configurable center bias, saliency score, optional crop box, and multipart uploads while keeping the core JSON contract stable.

Test plan

  • CI passes on this PR (pytest + ruff)
  • GET /health returns 200
  • GET /focus?path=<local-image> returns focus + dimensions
  • GET /focus?url=<image-url> works for internal image URLs
  • POST /focus with multipart file returns 200
  • Oversized image / tiny image return 413 / 400 with structured error codes
  • Docker build and run: docker build -t saliency-focus . && docker run --rm -p 5000:5000 saliency-focus

Refactor the service into a testable app factory with typed errors,
resource limits, and correct HTTP status codes. Upgrade Flask, OpenCV,
and NumPy; fix Docker with gunicorn, health checks, and a non-root user.
Add pytest coverage, ruff linting, and GitHub Actions CI. Extend /focus
with algorithm selection, center bias, saliency score, crop box, and
multipart uploads while keeping the core JSON contract stable.
@ibrahimjspy
ibrahimjspy merged commit 0cc8324 into main Jul 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant