romsyflux commited on
Commit
da15acf
1 Parent(s): 53c6c5f

Fix for no_end_timestamp

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -89,9 +89,11 @@ def transcribe(sr, data):
89
  processed_data = np.array(data).astype(np.float32) / 32767.0
90
  # results from the pipeline
91
  transcription_res = pipe({"sampling_rate": sr, "raw": processed_data},return_timestamps=True)
92
- labels = processor.tokenizer(transcription_res["text"]).input_ids
93
- decoded_with_special = processor.tokenizer.decode(labels, skip_special_tokens=False)
94
- print(decoded_with_special)
 
 
95
  return transcription_res
96
 
97
  def format_string(timestamp):
 
89
  processed_data = np.array(data).astype(np.float32) / 32767.0
90
  # results from the pipeline
91
  transcription_res = pipe({"sampling_rate": sr, "raw": processed_data},return_timestamps=True)
92
+ inputs = processor(processed_data, retur_tensors="pt")
93
+ input_features = inputs.input_features
94
+ generated_ids = model.generate(inputs=input_features,truncation=False, padding="longest", return_attention_mask=True, sampling_rate=sr,return_token_timestamps=True,return_timestamps=True)
95
+ transcription = processor.batch_decode(generated_ids, skip_special_tokens=False)
96
+ print(transcription)
97
  return transcription_res
98
 
99
  def format_string(timestamp):