benderrodriguez commited on
Commit
7c2f56b
1 Parent(s): f15b76e

Initial skeleton handler.

Browse files
Files changed (2) hide show
  1. handler.py +28 -0
  2. requirements.txt +1 -0
handler.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Dict, List, Any
2
+ import faster_whisper
3
+
4
+ class EndpointHandler():
5
+ def __init__(self, path=""):
6
+ self.model = faster_whisper.WhisperModel('ivrit-ai/faster-whisper-v2-d3-e3', device='cuda')
7
+
8
+ def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
9
+ """
10
+ data args:
11
+ inputs (:obj: `str`)
12
+ date (:obj: `str`)
13
+ Return:
14
+ A :obj:`list` | `dict`: will be serialized and returned
15
+ """
16
+ # get inputs
17
+ #inputs = data.pop("inputs",data)
18
+ #date = data.pop("date", None)
19
+
20
+ # check if date exists and if it is a holiday
21
+ #if date is not None and date in self.holidays:
22
+ # return [{"label": "happy", "score": 1}]
23
+
24
+
25
+ # run normal prediction
26
+ #prediction = self.pipeline(inputs)
27
+ return {'text' : 'bender is great!'}
28
+
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ faster-whisper