adds ssl possibility in basic server
This commit is contained in:
commit
29978da301
3 changed files with 37 additions and 10 deletions
10
README.md
10
README.md
|
|
@ -53,6 +53,14 @@ whisperlivekit-server --model tiny.en
|
||||||
# Open your browser at http://localhost:8000
|
# Open your browser at http://localhost:8000
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Quick Start with SSL
|
||||||
|
```bash
|
||||||
|
# You must provide a certificate and key
|
||||||
|
whisperlivekit-server -ssl-certfile public.crt --ssl-keyfile private.key
|
||||||
|
|
||||||
|
# Open your browser at https://localhost:8000
|
||||||
|
```
|
||||||
|
|
||||||
That's it! Start speaking and watch your words appear on screen.
|
That's it! Start speaking and watch your words appear on screen.
|
||||||
|
|
||||||
## 🛠️ Installation Options
|
## 🛠️ Installation Options
|
||||||
|
|
@ -201,6 +209,8 @@ WhisperLiveKit offers extensive configuration options:
|
||||||
| `--no-vad` | Disable Voice Activity Detection | `False` |
|
| `--no-vad` | Disable Voice Activity Detection | `False` |
|
||||||
| `--buffer_trimming` | Buffer trimming strategy (`sentence` or `segment`) | `segment` |
|
| `--buffer_trimming` | Buffer trimming strategy (`sentence` or `segment`) | `segment` |
|
||||||
| `--warmup-file` | Audio file path for model warmup | `jfk.wav` |
|
| `--warmup-file` | Audio file path for model warmup | `jfk.wav` |
|
||||||
|
| `--ssl-certfile` | Path to the SSL certificate file (for HTTPS support) | `None` |
|
||||||
|
| `--ssl-keyfile` | Path to the SSL private key file (for HTTPS support) | `None` |
|
||||||
|
|
||||||
## 🔧 How It Works
|
## 🔧 How It Works
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@ from whisperlivekit.audio_processor import AudioProcessor
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os, sys
|
||||||
|
import argparse
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
|
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
|
||||||
logging.getLogger().setLevel(logging.WARNING)
|
logging.getLogger().setLevel(logging.WARNING)
|
||||||
|
|
@ -74,14 +75,29 @@ def main():
|
||||||
|
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
|
|
||||||
uvicorn.run(
|
uvicorn_kwargs = {
|
||||||
"whisperlivekit.basic_server:app",
|
"app": "whisperlivekit.basic_server:app",
|
||||||
host=args.host,
|
"host":args.host,
|
||||||
port=args.port,
|
"port":args.port,
|
||||||
reload=False,
|
"reload": False,
|
||||||
log_level="info",
|
"log_level": "info",
|
||||||
lifespan="on",
|
"lifespan": "on",
|
||||||
)
|
}
|
||||||
|
|
||||||
|
ssl_kwargs = {}
|
||||||
|
if args.ssl_certfile or args.ssl_keyfile:
|
||||||
|
if not (args.ssl_certfile and args.ssl_keyfile):
|
||||||
|
raise ValueError("Both --ssl-certfile and --ssl-keyfile must be specified together.")
|
||||||
|
ssl_kwargs = {
|
||||||
|
"ssl_certfile": args.ssl_certfile,
|
||||||
|
"ssl_keyfile": args.ssl_keyfile
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ssl_kwargs:
|
||||||
|
uvicorn_kwargs = {**uvicorn_kwargs, **ssl_kwargs}
|
||||||
|
|
||||||
|
uvicorn.run(**uvicorn_kwargs)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,8 @@
|
||||||
|
|
||||||
const host = window.location.hostname || "localhost";
|
const host = window.location.hostname || "localhost";
|
||||||
const port = window.location.port || "8000";
|
const port = window.location.port || "8000";
|
||||||
const defaultWebSocketUrl = `ws://${host}:${port}/asr`;
|
const protocol = window.location.protocol === "https:" ? "wss" : "ws";
|
||||||
|
const defaultWebSocketUrl = `${protocol}://${host}:${port}/asr`;
|
||||||
websocketInput.value = defaultWebSocketUrl;
|
websocketInput.value = defaultWebSocketUrl;
|
||||||
websocketUrl = defaultWebSocketUrl;
|
websocketUrl = defaultWebSocketUrl;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue