apenasissso commited on
Commit
be86be9
1 Parent(s): 9176a6a
Files changed (1) hide show
  1. handler.py +6 -4
handler.py CHANGED
@@ -6,15 +6,17 @@ from typing import Dict, List, Any
6
  class EndpointHandler:
7
  def __init__(self, path=""):
8
  self.model = EncoderClassifier.from_hparams("speechbrain/lang-id-voxlingua107-ecapa")
 
9
  logging.info('model loaded')
10
 
11
  def __call__(self, data: Dict[str, Any]) -> Dict[str, Any]:
12
- audio_url = data.pop("audio_url",data)
13
 
14
- logging.info(f'audio_url {audio_url}')
 
15
 
16
- output = self.model.classify_file(audio_url)
17
-
18
  return {
19
  "prediction": float(output[1].exp()[0]),
20
  "language": output[3][0],
 
6
  class EndpointHandler:
7
  def __init__(self, path=""):
8
  self.model = EncoderClassifier.from_hparams("speechbrain/lang-id-voxlingua107-ecapa")
9
+ print('model loaded')
10
  logging.info('model loaded')
11
 
12
  def __call__(self, data: Dict[str, Any]) -> Dict[str, Any]:
13
+ inputs = data.pop("inputs",data)
14
 
15
+ print('audio_url', inputs)
16
+ logging.info(f'audio_url {inputs}')
17
 
18
+ # run normal prediction
19
+ output = self.model.classify_file(inputs)
20
  return {
21
  "prediction": float(output[1].exp()[0]),
22
  "language": output[3][0],