add docker compose

This commit is contained in:
Moritz 2024-08-14 09:31:02 +02:00
parent 64ec45a9ce
commit 01f661d37b
3 changed files with 26 additions and 1 deletions

View file

@ -2,4 +2,7 @@
python3 -m venv .venv python3 -m venv .venv
source .venv/bin/activate source .venv/bin/activate
pip3 install -r requirements.txt pip3 install -r requirements.txt
docker compose up
python3 whisper.py
``` ```

22
docker-compose.yml Normal file
View file

@ -0,0 +1,22 @@
version: "3.4"
services:
whisper-asr-webservice:
image: onerahmet/openai-whisper-asr-webservice:latest
environment:
- ASR_MODEL=large-v3
#- ASR_ENGINE=openai_whisper
- ASR_ENGINE=faster_whisper
ports:
- "127.0.0.1:9000:9000"
volumes:
# ./app:/app/app
- cache-pip:/root/.cache/pip
- cache-poetry:/root/.cache/poetry
- cache-whisper:/root/.cache/whisper
volumes:
cache-pip:
cache-poetry:
cache-whisper:
cache-faster-whisper:

View file

@ -17,7 +17,6 @@ def audio_callback_closure(client: AsyncClient):
response = requests.post('http://127.0.0.1:9000/asr?encode=true&task=transcribe&word_timestamps=false&output=txt', files=files) response = requests.post('http://127.0.0.1:9000/asr?encode=true&task=transcribe&word_timestamps=false&output=txt', files=files)
room_id = room.room_id room_id = room.room_id
await client.room_send( await client.room_send(
# Watch out! If you join an old room you'll see lots of old messages
room_id=room_id, room_id=room_id,
message_type="m.room.message", message_type="m.room.message",
content={"msgtype": "m.text", "body": response.content.decode()}, content={"msgtype": "m.text", "body": response.content.decode()},
@ -39,6 +38,7 @@ async def main() -> None:
await client.sync() await client.sync()
for room in client.invited_rooms: for room in client.invited_rooms:
await client.join(room) await client.join(room)
# Watch out! If you join an old room you'll see lots of old messages
await client.sync_forever(timeout=30000) # milliseconds await client.sync_forever(timeout=30000) # milliseconds
asyncio.run(main()) asyncio.run(main())