From 0ce177b290e0d37bfc8bf0074d5b706302e7d6c1 Mon Sep 17 00:00:00 2001 From: Drew Bednar Date: Mon, 29 May 2023 22:25:45 -0400 Subject: [PATCH] Adding usage example --- .gitignore | 3 ++- README.md | 19 +++++++++++++++++++ pyinvoke/dev.py | 4 ++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 489bdd0..cfb8763 100644 --- a/.gitignore +++ b/.gitignore @@ -158,4 +158,5 @@ cython_debug/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ +.idea/ +.vscode/ diff --git a/README.md b/README.md index 0e63c16..4003a9c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,22 @@ # LocalWhisper Making OpenAPI's Open Whisper available via ReST API locally. + +## Features +- [x] Transcription +- [ ] Translation (Not-planned, but open to PRs) + +## Usage Example + +Similar to the OpenAI API we can post an audio file to `/audio/transcriptions` as a `multipart/form-data` type. + +``` +curl --request POST \ + --url http://localhost:9000/audio/transcriptions \ + --header 'Content-Type: multipart/form-data' \ + --header 'Accept: application/json' \ + --form 'file=@/path/to/file/example.wav;type=audio/wav' + --form 'model=whisper-1' +``` + +At present the `model` form field is not required or supported. The `WHISPER_BASE_ASR_MODEL` server configuration will be used to determine the Whisper model to use. diff --git a/pyinvoke/dev.py b/pyinvoke/dev.py index 776f515..588def3 100644 --- a/pyinvoke/dev.py +++ b/pyinvoke/dev.py @@ -26,6 +26,6 @@ def build(c): @task -def serve_dev(c): +def serve_dev(c, port=9000): """Runs the FastAPI webservice""" - c.run("uvicorn local_whisper.webservice:app --reload") + c.run(f"uvicorn local_whisper.webservice:app --reload --port {port}")