slplab commited on
Commit
cfed61f
1 Parent(s): 41dd0b3

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +2 -1
handler.py CHANGED
@@ -4,11 +4,12 @@ import torch
4
  from transformers.pipelines.audio_utils import ffmpeg_read
5
 
6
  #ffmpeg
 
7
 
8
 
9
  class EndpointHandler:
10
  def __init__(self, path=""):
11
- self.pipe = pipeline(task='automatic-speech-recognition', model=path)
12
 
13
  def __call__(self, data: Any) -> List[Dict[str, str]]:
14
 
 
4
  from transformers.pipelines.audio_utils import ffmpeg_read
5
 
6
  #ffmpeg
7
+ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
8
 
9
 
10
  class EndpointHandler:
11
  def __init__(self, path=""):
12
+ self.pipe = pipeline(task='automatic-speech-recognition', model=path, device=device)
13
 
14
  def __call__(self, data: Any) -> List[Dict[str, str]]:
15