Update main/inference/realtime/client.py
Browse files
main/inference/realtime/client.py
CHANGED
|
@@ -286,6 +286,15 @@ async def record(request: Request):
|
|
| 286 |
"path": record_audio_path
|
| 287 |
}
|
| 288 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 289 |
@app.websocket("/ws-audio")
|
| 290 |
async def websocket_audio(ws: WebSocket):
|
| 291 |
"""
|
|
|
|
| 286 |
"path": record_audio_path
|
| 287 |
}
|
| 288 |
|
| 289 |
+
import spaces
|
| 290 |
+
|
| 291 |
+
def gpu_if_available(func):
|
| 292 |
+
try:
|
| 293 |
+
return spaces.GPU(func)
|
| 294 |
+
except NotImplementedError:
|
| 295 |
+
return func
|
| 296 |
+
|
| 297 |
+
@gpu_if_available
|
| 298 |
@app.websocket("/ws-audio")
|
| 299 |
async def websocket_audio(ws: WebSocket):
|
| 300 |
"""
|