-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
WHISPER_NAME="openai/whisper-tiny.en" | ||
LOCAL_STORAGE_FOLDER_PATH="/data" | ||
HUEY_BUS_REDIS_HOST="host.docker.internal" | ||
MODEL="speech_recognition_api.extra.whisper_model.WhisperModel" | ||
STORAGE="speech_recognition_api.extra.local_storage.LocalStorage" | ||
MESSAGE_BUS="speech_recognition_api.extra.huey_bus.HueyMessageBus" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM python:3.11-slim as base | ||
|
||
RUN apt-get update && apt-get install -y ffmpeg | ||
COPY requirements.txt requirements.txt | ||
RUN pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu | ||
|
||
FROM base as api | ||
CMD [ \ | ||
"gunicorn", \ | ||
"speech_recognition_api:create_app()", \ | ||
"-k", \ | ||
"uvicorn.workers.UvicornWorker", \ | ||
"-w", \ | ||
"1", \ | ||
"-b", \ | ||
"0.0.0.0:8888" \ | ||
] | ||
|
||
FROM base as worker | ||
CMD [ \ | ||
"huey_consumer", \ | ||
"speech_recognition_api.extra.huey_bus.huey" \ | ||
] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## Docker Compose example | ||
|
||
This example demonstrates one of the ways to build containers: | ||
API server and async worker. | ||
|
||
In this example they communicate using Huey and Redis, saving data to | ||
a local folder. | ||
|
||
### Running the example | ||
|
||
```bash | ||
docker compose up | ||
``` | ||
|
||
The service is going to be available at http://localhost:8888 | ||
|
||
You can visit http://localhost:8888/docs to try it right in your browser. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
version: "3.8" | ||
services: | ||
api: | ||
env_file: | ||
- .env.example | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
target: api | ||
volumes: | ||
- "./data:/data" | ||
ports: | ||
- "8888:8888" | ||
depends_on: | ||
redis: | ||
condition: service_started | ||
worker: | ||
env_file: | ||
- .env.example | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
target: worker | ||
volumes: | ||
- "./data:/data" | ||
depends_on: | ||
api: | ||
condition: service_started | ||
redis: | ||
condition: service_started | ||
redis: | ||
image: redis | ||
ports: | ||
- "6379:6379" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
speech-recognition-api[whisper,huey] | ||
redis | ||
gunicorn |