Skip to content

Add Gradio API mode for programmatic access #400

Description

@dreamlessx

Description

Add an API endpoint mode to the Gradio demo that allows programmatic access without the web UI, enabling integration with other tools and pipelines.

Current Behavior

The Gradio app (scripts/app.py) only serves the interactive web interface. Users who want to integrate LandmarkDiff into their pipelines must call the Python API directly.

Proposed Changes

  1. Add a /api/predict endpoint that accepts JSON with base64-encoded images
  2. Return JSON with the result image, landmarks, and metadata
  3. Add a --api-only flag to launch without the Gradio UI (lighter weight)
  4. Document the API schema with example curl commands

Acceptance Criteria

  • POST /api/predict accepts {"image": "<base64>", "procedure": "rhinoplasty", "intensity": 65}
  • Response includes {"result": "<base64>", "landmarks": [...], "procedure": "..."}
  • --api-only flag starts a lightweight FastAPI/Flask server
  • README documents the API with curl examples

Labels

enhancement

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status
    Todo
    Status
    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions