port 7200
This commit is contained in:
parent
fe8031122a
commit
4fd908918d
@ -19,7 +19,7 @@ WORKDIR /app
|
||||
COPY . /app
|
||||
|
||||
# Expose necessary ports
|
||||
EXPOSE 8000
|
||||
EXPOSE 7200
|
||||
|
||||
# Command to run the script
|
||||
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "7200"]
|
||||
@ -11,15 +11,15 @@
|
||||
|
||||
### 1-DEVELOPMENT
|
||||
#### Run the system : Uvicorn and Fastapi
|
||||
.venv/bin/uvicorn src.main:app --host 0.0.0.0 --port 8000
|
||||
.venv/bin/uvicorn src.main:app --host 0.0.0.0 --port 7200
|
||||
|
||||
### 2-DEPLOYMENT
|
||||
#### Docker Build
|
||||
docker build -t asr_farhang:latest --build-arg DEBIAN_FRONTEND=noninteractive .
|
||||
docker build -t asr_farhang:latest .
|
||||
|
||||
|
||||
#### Docker Run
|
||||
docker run -d --gpus all --network host --restart unless-stopped asr_farhang:latest
|
||||
#### Docker Run (port = 7200)
|
||||
docker run -d --network host --restart unless-stopped asr_farhang:latest
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
const ws = new WebSocket("ws://localhost:8000/asr");
|
||||
const ws = new WebSocket("ws://localhost:7200/asr");
|
||||
|
||||
ws.onmessage = (event) => {
|
||||
console.log("ASR Result:", event.data);
|
||||
|
||||
16
test/test.py
16
test/test.py
@ -2,26 +2,30 @@ import asyncio
|
||||
import websockets
|
||||
import json
|
||||
|
||||
AUDIO_FILE = "./khabar_1_5.wav" # Replace with your audio file path
|
||||
WS_URL = "ws://127.0.0.1:8000/asr"
|
||||
AUDIO_FILE = "./data/khabar_1_5.wav"
|
||||
WS_URL = "ws://127.0.0.1:7200/asr"
|
||||
|
||||
async def send_audio():
|
||||
async with websockets.connect(WS_URL) as ws:
|
||||
print("Connected to ASR WebSocket")
|
||||
|
||||
# Read the audio file in chunks
|
||||
# Send audio in chunks
|
||||
with open(AUDIO_FILE, "rb") as f:
|
||||
chunk_size = 21920
|
||||
chunk_size = 100000
|
||||
while chunk := f.read(chunk_size):
|
||||
await ws.send(chunk)
|
||||
|
||||
|
||||
# Tell server no more audio is coming
|
||||
await ws.send(json.dumps({"eof": True}))
|
||||
|
||||
# Receive results
|
||||
try:
|
||||
while True:
|
||||
message = await ws.recv()
|
||||
data = json.loads(message)
|
||||
print("Received:", data)
|
||||
|
||||
except websockets.exceptions.ConnectionClosed:
|
||||
print("WebSocket closed by server")
|
||||
|
||||
# Run the async client
|
||||
asyncio.run(send_audio())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user