Skip to content

RescueBoxAPI

jai kumar edited this page Mar 4, 2025 · 8 revisions

Fastapi tests

This is a FastAPI application that provides a set of endpoints for the RescueBox project by converting the existing CLI commands into REST API endpoints.

Running the API

# src/rb-api
poetry install
poetry run python -m src.rb-api.rb.api.main

# or
#
./run_server

The API server will be available at http://localhost:8000.

Test rest-api with curl or RescueBox-Desktop UI

curl "http://localhost:8000/audio/app_metadata"

curl -ilk -v -X POST --data @audio.json --header "Content-Type: application/json" "http://localhost:8000/audio/transcribe"

where audio.json contains the json path to the mp3 file
'{"inputs": {"dir_input": {"path": "C:\\src\rb-audio-transcription\tests"}} }'

To test cli only

poetry run typer rb_audio_transcription.main run --help

Invoke transcribe cli function in the rb-audio-transcription plugin

poetry run typer rb_audio_transcription.main run transcribe "full_path_to_mp3_file"

note: pytest will not invoke commands from the "api" server

poetry run pytest  src\rb-audio-transcription\tests\test_main.py -s