Simple FastAPI server allowing running sonics (AI music detector) on spotify tracks.
Running
uv run fastapi dev --host 0.0.0.0 .\server.pyEndpoints
- GET /health — quick health check
- GET /infer?url= — run inference on an HTTP URL or Spotify URL
- GET /infer?track_id= — run inference by Spotify track id
Swagger UI will be available at /docs when the server is running.
Notes
- The server lazily loads the sonics model on first inference request. Set
SONICS_MODELenv var to change the model id. - The Spotify API credentials (SPOTIFY_CLIENT_ID / SPOTIFY_CLIENT_SECRET) should be set in environment or
.envif you want the Spotipy path to work.