Skip to content

feat(server): GET /segments endpoint — JSON in seconds, gzip, CORS, cache#13

Merged
AmitMY merged 2 commits intomainfrom
feature/get-segments-endpoint
Mar 23, 2026
Merged

feat(server): GET /segments endpoint — JSON in seconds, gzip, CORS, cache#13
AmitMY merged 2 commits intomainfrom
feature/get-segments-endpoint

Conversation

@AmitMY
Copy link
Copy Markdown
Contributor

@AmitMY AmitMY commented Mar 23, 2026

Summary

  • GET /segments?pose=<path> resolves the pose (supports gs://), runs segmentation, and returns:
    {"sign": [{"start": 0.0, "end": 1.2}], "sentence": [...]}
    Times are in seconds (not frames).
  • Shared load_pose() and tiers_to_seconds() helpers extracted from the POST handler.
  • Gzip-compressed JSON response.
  • CORS headers (Access-Control-Allow-Origin: *) added to all responses via after_request hook.
  • Cache-Control: public, max-age=86400 (1 day) on GET /segments.
  • OPTIONS preflight returns 204 for CORS preflight requests.

Test plan

  • GET /segments?pose=/path/to/example.pose returns gzipped JSON with sign/sentence arrays
  • Start/end values are in seconds (float), not frame indices
  • curl -I shows Content-Encoding: gzip and Cache-Control: public, max-age=86400
  • Cross-origin request from browser includes Access-Control-Allow-Origin: *
  • POST / still works as before

🤖 Generated with Claude Code

AmitMY and others added 2 commits March 23, 2026 04:45
- GET /segments?pose=<path> resolves pose, runs segmentation, returns
  {"sign": [{"start": 0.0, "end": 1.2}], "sentence": [...]} in seconds
- Extracts shared load_pose() and tiers_to_seconds() helpers
- Gzip-compressed JSON response
- CORS headers on all responses (after_request hook)
- Cache-Control: public, max-age=86400 (1 day) on GET /segments
- OPTIONS preflight handled for /segments

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…o 3dp

- GET /?pose=<path> and POST / both live on /
- flask-cors: CORS only on GET /
- flask-compress + @compress.compressed(): automatic gzip
- flask-caching SimpleCache: server-side cache by URL (1 day TTL)
- Cache-Control: public, max-age=86400 on GET response
- Round segment times to 3 decimal places (1ms precision)
- Add Flask-Cors, Flask-Compress, Flask-Caching to server extras

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@AmitMY AmitMY merged commit c2004f4 into main Mar 23, 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