Spaces:
Runtime error
Runtime error
chore: suppress websocket probe handshake tracebacks
Browse files- kimodo/demo/app.py +6 -0
kimodo/demo/app.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
| 2 |
# SPDX-License-Identifier: Apache-2.0
|
| 3 |
|
| 4 |
import base64
|
|
|
|
| 5 |
import os
|
| 6 |
import shutil
|
| 7 |
import threading
|
|
@@ -51,6 +52,11 @@ from .embedding_cache import CachedTextEncoder
|
|
| 51 |
from .queue_manager import QueueManager, UserQueue
|
| 52 |
from .state import ClientSession, ModelBundle
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
class Demo:
|
| 56 |
def __init__(self, default_model_name: str = DEFAULT_MODEL):
|
|
|
|
| 2 |
# SPDX-License-Identifier: Apache-2.0
|
| 3 |
|
| 4 |
import base64
|
| 5 |
+
import logging
|
| 6 |
import os
|
| 7 |
import shutil
|
| 8 |
import threading
|
|
|
|
| 52 |
from .queue_manager import QueueManager, UserQueue
|
| 53 |
from .state import ClientSession, ModelBundle
|
| 54 |
|
| 55 |
+
# Hosted runtimes (HF/Cloud Run) often send non-WS probes to the WS endpoint.
|
| 56 |
+
# Suppress noisy stack traces for these expected invalid handshakes.
|
| 57 |
+
logging.getLogger("websockets.server").setLevel(logging.CRITICAL)
|
| 58 |
+
logging.getLogger("websockets.asyncio.server").setLevel(logging.CRITICAL)
|
| 59 |
+
|
| 60 |
|
| 61 |
class Demo:
|
| 62 |
def __init__(self, default_model_name: str = DEFAULT_MODEL):
|