feat(server): GET /segments endpoint — JSON in seconds, gzip, CORS, cache#13
Merged
feat(server): GET /segments endpoint — JSON in seconds, gzip, CORS, cache#13
Conversation
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GET /segments?pose=<path>resolves the pose (supportsgs://), runs segmentation, and returns:{"sign": [{"start": 0.0, "end": 1.2}], "sentence": [...]}load_pose()andtiers_to_seconds()helpers extracted from the POST handler.Access-Control-Allow-Origin: *) added to all responses viaafter_requesthook.Cache-Control: public, max-age=86400(1 day) on GET /segments.Test plan
GET /segments?pose=/path/to/example.posereturns gzipped JSON withsign/sentencearrayscurl -IshowsContent-Encoding: gzipandCache-Control: public, max-age=86400Access-Control-Allow-Origin: */still works as before🤖 Generated with Claude Code