Update handler.py
Browse files- handler.py +5 -1
handler.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import logging
|
| 2 |
import torch
|
| 3 |
import os
|
|
|
|
| 4 |
|
| 5 |
from pyannote.audio import Pipeline
|
| 6 |
from transformers import pipeline, AutoModelForCausalLM
|
|
@@ -50,7 +51,10 @@ class EndpointHandler():
|
|
| 50 |
self.diarization_pipeline = None
|
| 51 |
|
| 52 |
|
| 53 |
-
async def __call__(self,
|
|
|
|
|
|
|
|
|
|
| 54 |
try:
|
| 55 |
parameters = InferenceConfig(**parameters)
|
| 56 |
except ValidationError as e:
|
|
|
|
| 1 |
import logging
|
| 2 |
import torch
|
| 3 |
import os
|
| 4 |
+
import base64
|
| 5 |
|
| 6 |
from pyannote.audio import Pipeline
|
| 7 |
from transformers import pipeline, AutoModelForCausalLM
|
|
|
|
| 51 |
self.diarization_pipeline = None
|
| 52 |
|
| 53 |
|
| 54 |
+
async def __call__(self, inputs):
|
| 55 |
+
file = inputs.pop("inputs")
|
| 56 |
+
file = base64.b64decode(file)
|
| 57 |
+
parameters = inputs.pop("parameters", {})
|
| 58 |
try:
|
| 59 |
parameters = InferenceConfig(**parameters)
|
| 60 |
except ValidationError as e:
|