MeBai commited on
Commit
f7fb0b4
·
verified ·
1 Parent(s): 62d7baf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -50,16 +50,16 @@ def transcribe(audio_path):
50
  audio_cnt, sr = librosa.load(audio_path, sr=16000)
51
 
52
  # 将音频数据传递给 processor
53
- input_values = processor(audio_cnt, sampling_rate=16000, return_tensors="pt")
54
 
55
- print(input_values)
56
 
57
  # 模型推理
58
  with torch.no_grad():
59
- predicted_ids = model.generate(input_values)
60
 
61
  # 解码得到转录结果
62
- transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)[0]
63
 
64
  return transcription
65
 
 
50
  audio_cnt, sr = librosa.load(audio_path, sr=16000)
51
 
52
  # 将音频数据传递给 processor
53
+ input_features = processor(audio_cnt, sampling_rate=16000, return_tensors="pt").input_features
54
 
55
+ print(input_features)
56
 
57
  # 模型推理
58
  with torch.no_grad():
59
+ generated_ids = model.generate(input_features)
60
 
61
  # 解码得到转录结果
62
+ transcription = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
63
 
64
  return transcription
65