nithinraok commited on
Commit
40890a4
1 Parent(s): e5573db

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -25
app.py CHANGED
@@ -64,32 +64,8 @@ def get_transcripts(df, audio_path):
64
  filename = create_manifest(df,audio_path)
65
  model = EncDecRNNTBPEModel.from_pretrained(model_name="nvidia/stt_en_fastconformer_transducer_large").to(device)
66
  model.eval()
67
- config = OmegaConf.create({"manifest_filepath": filename, 'batch_size': 2})
68
- dataloader = model._setup_transcribe_dataloader(config)
69
 
70
- hypotheses = []
71
- all_hypotheses = []
72
-
73
- for test_batch in (dataloader):
74
- encoded, encoded_len = model.forward(
75
- input_signal=test_batch[0].to(device), input_signal_length=test_batch[1].to(device)
76
- )
77
- best_hyp, all_hyp = model.decoding.rnnt_decoder_predictions_tensor(
78
- encoded,
79
- encoded_len,
80
- return_hypotheses=False,
81
- partial_hypotheses=None,)
82
-
83
- hypotheses += best_hyp
84
- if all_hyp is not None:
85
- all_hypotheses += all_hyp
86
- else:
87
- all_hypotheses += best_hyp
88
-
89
- del encoded
90
- del test_batch
91
-
92
- return hypotheses
93
 
94
  article = (
95
  "<p style='text-align: center'>"
 
64
  filename = create_manifest(df,audio_path)
65
  model = EncDecRNNTBPEModel.from_pretrained(model_name="nvidia/stt_en_fastconformer_transducer_large").to(device)
66
  model.eval()
67
+ return model.transcribe(filename, batch_size=2)
 
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
  article = (
71
  "<p style='text-align: center'>"