Spaces:
Sleeping
Sleeping
improved the real time detection
Browse files- src/api/app.py +3 -3
src/api/app.py
CHANGED
|
@@ -150,7 +150,7 @@ async def predict_emotion(file: UploadFile = File(...)):
|
|
| 150 |
@app.websocket("/stream/audio")
|
| 151 |
async def stream_audio(websocket: WebSocket, rate: int = 16000):
|
| 152 |
await websocket.accept()
|
| 153 |
-
print(f"
|
| 154 |
buffer = AudioStreamBuffer()
|
| 155 |
|
| 156 |
# Pre-configure resampler if rate != 16000
|
|
@@ -194,9 +194,9 @@ async def stream_audio(websocket: WebSocket, rate: int = 16000):
|
|
| 194 |
await websocket.send_json(response)
|
| 195 |
|
| 196 |
except WebSocketDisconnect:
|
| 197 |
-
print("
|
| 198 |
except Exception as e:
|
| 199 |
-
print(f"
|
| 200 |
try:
|
| 201 |
await websocket.close()
|
| 202 |
except: pass
|
|
|
|
| 150 |
@app.websocket("/stream/audio")
|
| 151 |
async def stream_audio(websocket: WebSocket, rate: int = 16000):
|
| 152 |
await websocket.accept()
|
| 153 |
+
print(f"WebSocket Connected (Input Rate: {rate}Hz)")
|
| 154 |
buffer = AudioStreamBuffer()
|
| 155 |
|
| 156 |
# Pre-configure resampler if rate != 16000
|
|
|
|
| 194 |
await websocket.send_json(response)
|
| 195 |
|
| 196 |
except WebSocketDisconnect:
|
| 197 |
+
print("WebSocket Disconnected")
|
| 198 |
except Exception as e:
|
| 199 |
+
print(f"WebSocket Error: {e}")
|
| 200 |
try:
|
| 201 |
await websocket.close()
|
| 202 |
except: pass
|