Spaces:
Paused
Paused
MacBook pro
commited on
Commit
·
301d020
1
Parent(s):
cd1ce19
feat(startup-log): B13 enhanced startup logging (config + gpu + video fps limit)
Browse files
app.py
CHANGED
|
@@ -196,8 +196,38 @@ async def gpu_info():
|
|
| 196 |
|
| 197 |
@app.on_event("startup")
|
| 198 |
async def log_config():
|
| 199 |
-
#
|
| 200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
|
| 202 |
|
| 203 |
# Note: The Dockerfile / README launch with: uvicorn app:app --port 7860
|
|
|
|
| 196 |
|
| 197 |
@app.on_event("startup")
|
| 198 |
async def log_config():
|
| 199 |
+
# Enhanced startup logging: core config + GPU availability summary.
|
| 200 |
+
cfg = config.as_dict()
|
| 201 |
+
# GPU probe (reuse gpu_info logic minimally without full device list to keep log concise)
|
| 202 |
+
gpu_available = False
|
| 203 |
+
gpu_name = None
|
| 204 |
+
try:
|
| 205 |
+
import torch # type: ignore
|
| 206 |
+
if torch.cuda.is_available():
|
| 207 |
+
gpu_available = True
|
| 208 |
+
gpu_name = torch.cuda.get_device_name(0)
|
| 209 |
+
else:
|
| 210 |
+
# Fallback quick nvidia-smi single line
|
| 211 |
+
try:
|
| 212 |
+
out = subprocess.check_output([
|
| 213 |
+
"nvidia-smi", "--query-gpu=name", "--format=csv,noheader,nounits"
|
| 214 |
+
], stderr=subprocess.STDOUT, timeout=1).decode("utf-8").strip().splitlines()
|
| 215 |
+
if out:
|
| 216 |
+
gpu_available = True
|
| 217 |
+
gpu_name = out[0].strip()
|
| 218 |
+
except Exception: # noqa: BLE001
|
| 219 |
+
pass
|
| 220 |
+
except Exception: # noqa: BLE001
|
| 221 |
+
pass
|
| 222 |
+
startup_line = {
|
| 223 |
+
"chunk_ms": cfg.get("chunk_ms"),
|
| 224 |
+
"voice_enabled": cfg.get("voice_enable"),
|
| 225 |
+
"metrics_fps_window": cfg.get("metrics_fps_window"),
|
| 226 |
+
"video_fps_limit": cfg.get("video_max_fps"),
|
| 227 |
+
"gpu_available": gpu_available,
|
| 228 |
+
"gpu_name": gpu_name,
|
| 229 |
+
}
|
| 230 |
+
print("[startup]", startup_line)
|
| 231 |
|
| 232 |
|
| 233 |
# Note: The Dockerfile / README launch with: uvicorn app:app --port 7860
|