Update handler.py
Browse files- 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="
|
| 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.
|
| 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
|