Evan-Lin commited on
Commit
2eb1a84
·
1 Parent(s): 50facab

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +3 -3
handler.py CHANGED
@@ -3,8 +3,8 @@ from transformers import pipeline
3
  import holidays
4
 
5
  class EndpointHandler():
6
- def __init__(self, path="Evan-Lin/whisper-large-tw"):
7
- self.pipeline = pipeline(model=path)
8
  self.pipeline.model.config.forced_decoder_ids = self.pipeline.model.processor.get_decoder_prompt_ids(language="Chinese", task="transcribe")
9
  self.pipeline.model.generation_config.forced_decoder_ids = self.pipeline.model.config.forced_decoder_ids # just to be sure!
10
 
@@ -20,5 +20,5 @@ class EndpointHandler():
20
 
21
  # run normal prediction
22
  inputs = data.pop("inputs",data)
23
- prediction = self.pipe(inputs, return_timestamps=False)
24
  return prediction
 
3
  import holidays
4
 
5
  class EndpointHandler():
6
+ def __init__(self, path="."):
7
+ self.pipeline = pipeline(task="automatic-speech-recognition", model=path)
8
  self.pipeline.model.config.forced_decoder_ids = self.pipeline.model.processor.get_decoder_prompt_ids(language="Chinese", task="transcribe")
9
  self.pipeline.model.generation_config.forced_decoder_ids = self.pipeline.model.config.forced_decoder_ids # just to be sure!
10
 
 
20
 
21
  # run normal prediction
22
  inputs = data.pop("inputs",data)
23
+ prediction = self.pipeline(inputs, return_timestamps=False)
24
  return prediction