remove temp_kit method to get args. uvicorn reload to False for better perfs
This commit is contained in:
parent
d94560ef37
commit
3ac4c514cf
3 changed files with 15 additions and 13 deletions
|
|
@ -3,7 +3,7 @@ from fastapi import FastAPI, WebSocket, WebSocketDisconnect
|
||||||
from fastapi.responses import HTMLResponse
|
from fastapi.responses import HTMLResponse
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
|
||||||
from whisperlivekit import WhisperLiveKit
|
from whisperlivekit import WhisperLiveKit, parse_args
|
||||||
from whisperlivekit.audio_processor import AudioProcessor
|
from whisperlivekit.audio_processor import AudioProcessor
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
@ -71,12 +71,13 @@ async def websocket_endpoint(websocket: WebSocket):
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|
||||||
temp_kit = WhisperLiveKit(transcription=False, diarization=False)
|
args = parse_args()
|
||||||
|
|
||||||
uvicorn.run(
|
uvicorn.run(
|
||||||
"whisper_fastapi_online_server:app",
|
"whisper_fastapi_online_server:app",
|
||||||
host=temp_kit.args.host,
|
host=args.host,
|
||||||
port=temp_kit.args.port,
|
port=args.port,
|
||||||
reload=True,
|
reload=False,
|
||||||
log_level="info"
|
log_level="info",
|
||||||
|
lifespan="on",
|
||||||
)
|
)
|
||||||
|
|
@ -3,7 +3,7 @@ from fastapi import FastAPI, WebSocket, WebSocketDisconnect
|
||||||
from fastapi.responses import HTMLResponse
|
from fastapi.responses import HTMLResponse
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
|
||||||
from whisperlivekit import WhisperLiveKit
|
from whisperlivekit import WhisperLiveKit, parse_args
|
||||||
from whisperlivekit.audio_processor import AudioProcessor
|
from whisperlivekit.audio_processor import AudioProcessor
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
@ -72,14 +72,15 @@ def main():
|
||||||
"""Entry point for the CLI command."""
|
"""Entry point for the CLI command."""
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|
||||||
temp_kit = WhisperLiveKit(transcription=False, diarization=False)
|
args = parse_args()
|
||||||
|
|
||||||
uvicorn.run(
|
uvicorn.run(
|
||||||
"whisperlivekit.basic_server:app",
|
"whisperlivekit.basic_server:app",
|
||||||
host=temp_kit.args.host,
|
host=args.host,
|
||||||
port=temp_kit.args.port,
|
port=args.port,
|
||||||
reload=True,
|
reload=False,
|
||||||
log_level="info"
|
log_level="info",
|
||||||
|
lifespan="on",
|
||||||
)
|
)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ def warmup_asr(asr, warmup_file=None, timeout=5):
|
||||||
logger.warning(f"Warmup file {warmup_file} invalid or missing.")
|
logger.warning(f"Warmup file {warmup_file} invalid or missing.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
print(f"Warmping up Whisper with {warmup_file}")
|
print(f"Warming up Whisper with {warmup_file}")
|
||||||
try:
|
try:
|
||||||
import librosa
|
import librosa
|
||||||
audio, sr = librosa.load(warmup_file, sr=16000)
|
audio, sr = librosa.load(warmup_file, sr=16000)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue