Update handler.py
Browse files- handler.py +3 -2
handler.py
CHANGED
@@ -4,9 +4,10 @@ import io
|
|
4 |
|
5 |
class EndpointHandler:
|
6 |
def __init__(self, model_dir=None):
|
7 |
-
#
|
8 |
model_size = "large-v2" if model_dir is None else model_dir
|
9 |
-
|
|
|
10 |
|
11 |
def __call__(self, data: Dict) -> Dict[str, str]:
|
12 |
# Process the input data expected to be in 'inputs' key containing audio file bytes
|
|
|
4 |
|
5 |
class EndpointHandler:
|
6 |
def __init__(self, model_dir=None):
|
7 |
+
# Set model size, assuming installation has been done with appropriate model files and setup
|
8 |
model_size = "large-v2" if model_dir is None else model_dir
|
9 |
+
# Change to 'cuda' to use the GPU, and set compute_type for faster computation
|
10 |
+
self.model = WhisperModel(model_size, device="cuda", compute_type="float16")
|
11 |
|
12 |
def __call__(self, data: Dict) -> Dict[str, str]:
|
13 |
# Process the input data expected to be in 'inputs' key containing audio file bytes
|