srd4 commited on
Commit
d1e2411
1 Parent(s): ce691da

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +1 -8
handler.py CHANGED
@@ -10,14 +10,7 @@ class EndpointHandler:
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
14
- audio_bytes = data["inputs"]
15
-
16
- # Convert bytes to a file-like object
17
- audio_file = io.BytesIO(audio_bytes)
18
-
19
- # Perform transcription using the model
20
- segments, info = self.model.transcribe(audio_file)
21
 
22
  # Compile the results into a text string and extract language information
23
  # Strip whitespace from each segment before joining them
 
10
  self.model = WhisperModel(model_size, device="cuda", compute_type="float16")
11
 
12
  def __call__(self, data: Dict) -> Dict[str, str]:
13
+ segments, info = self.model.transcribe(data["inputs"])
 
 
 
 
 
 
 
14
 
15
  # Compile the results into a text string and extract language information
16
  # Strip whitespace from each segment before joining them