remove temp_kit method to get args. uvicorn reload to False for better perfs
Browse files
whisper_fastapi_online_server.py
CHANGED
@@ -3,7 +3,7 @@ from fastapi import FastAPI, WebSocket, WebSocketDisconnect
|
|
3 |
from fastapi.responses import HTMLResponse
|
4 |
from fastapi.middleware.cors import CORSMiddleware
|
5 |
|
6 |
-
from whisperlivekit import WhisperLiveKit
|
7 |
from whisperlivekit.audio_processor import AudioProcessor
|
8 |
|
9 |
import asyncio
|
@@ -71,12 +71,13 @@ async def websocket_endpoint(websocket: WebSocket):
|
|
71 |
if __name__ == "__main__":
|
72 |
import uvicorn
|
73 |
|
74 |
-
|
75 |
|
76 |
uvicorn.run(
|
77 |
"whisper_fastapi_online_server:app",
|
78 |
-
host=
|
79 |
-
port=
|
80 |
-
reload=
|
81 |
-
log_level="info"
|
|
|
82 |
)
|
|
|
3 |
from fastapi.responses import HTMLResponse
|
4 |
from fastapi.middleware.cors import CORSMiddleware
|
5 |
|
6 |
+
from whisperlivekit import WhisperLiveKit, parse_args
|
7 |
from whisperlivekit.audio_processor import AudioProcessor
|
8 |
|
9 |
import asyncio
|
|
|
71 |
if __name__ == "__main__":
|
72 |
import uvicorn
|
73 |
|
74 |
+
args = parse_args()
|
75 |
|
76 |
uvicorn.run(
|
77 |
"whisper_fastapi_online_server:app",
|
78 |
+
host=args.host,
|
79 |
+
port=args.port,
|
80 |
+
reload=False,
|
81 |
+
log_level="info",
|
82 |
+
lifespan="on",
|
83 |
)
|
whisperlivekit/basic_server.py
CHANGED
@@ -3,7 +3,7 @@ from fastapi import FastAPI, WebSocket, WebSocketDisconnect
|
|
3 |
from fastapi.responses import HTMLResponse
|
4 |
from fastapi.middleware.cors import CORSMiddleware
|
5 |
|
6 |
-
from whisperlivekit import WhisperLiveKit
|
7 |
from whisperlivekit.audio_processor import AudioProcessor
|
8 |
|
9 |
import asyncio
|
@@ -72,14 +72,15 @@ def main():
|
|
72 |
"""Entry point for the CLI command."""
|
73 |
import uvicorn
|
74 |
|
75 |
-
|
76 |
|
77 |
uvicorn.run(
|
78 |
"whisperlivekit.basic_server:app",
|
79 |
-
host=
|
80 |
-
port=
|
81 |
-
reload=
|
82 |
-
log_level="info"
|
|
|
83 |
)
|
84 |
|
85 |
if __name__ == "__main__":
|
|
|
3 |
from fastapi.responses import HTMLResponse
|
4 |
from fastapi.middleware.cors import CORSMiddleware
|
5 |
|
6 |
+
from whisperlivekit import WhisperLiveKit, parse_args
|
7 |
from whisperlivekit.audio_processor import AudioProcessor
|
8 |
|
9 |
import asyncio
|
|
|
72 |
"""Entry point for the CLI command."""
|
73 |
import uvicorn
|
74 |
|
75 |
+
args = parse_args()
|
76 |
|
77 |
uvicorn.run(
|
78 |
"whisperlivekit.basic_server:app",
|
79 |
+
host=args.host,
|
80 |
+
port=args.port,
|
81 |
+
reload=False,
|
82 |
+
log_level="info",
|
83 |
+
lifespan="on",
|
84 |
)
|
85 |
|
86 |
if __name__ == "__main__":
|
whisperlivekit/whisper_streaming_custom/whisper_online.py
CHANGED
@@ -179,7 +179,7 @@ def warmup_asr(asr, warmup_file=None, timeout=5):
|
|
179 |
logger.warning(f"Warmup file {warmup_file} invalid or missing.")
|
180 |
return False
|
181 |
|
182 |
-
print(f"
|
183 |
try:
|
184 |
import librosa
|
185 |
audio, sr = librosa.load(warmup_file, sr=16000)
|
|
|
179 |
logger.warning(f"Warmup file {warmup_file} invalid or missing.")
|
180 |
return False
|
181 |
|
182 |
+
print(f"Warming up Whisper with {warmup_file}")
|
183 |
try:
|
184 |
import librosa
|
185 |
audio, sr = librosa.load(warmup_file, sr=16000)
|