AnhP commited on
Commit
aaa2e59
·
verified ·
1 Parent(s): 4bc0fb9

Update main/inference/realtime/client.py

Browse files
Files changed (1) hide show
  1. main/inference/realtime/client.py +9 -0
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
  """