Shubham09 commited on
Commit
c080796
·
1 Parent(s): fac7d33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -24,10 +24,10 @@ def load_data(input_file):
24
  speech = librosa.resample(speech, sample_rate,16000)
25
  return speech
26
 
27
- def correct_casing(input_sentence):
28
 
29
- sentences = nltk.sent_tokenize(input_sentence)
30
- return (' '.join([s.replace(s[0],s[0].capitalize(),1) for s in sentences]))
31
 
32
  def asr_transcript(input_file):
33
 
@@ -40,9 +40,9 @@ def asr_transcript(input_file):
40
  #Take argmax
41
  predicted_ids = torch.argmax(logits, dim=-1)
42
  #Get the words from predicted word ids
43
- transcription = tokenizer.decode(predicted_ids[0])
44
  #Correcting the letter casing
45
- transcription = correct_casing(transcription.lower())
46
  return transcription
47
 
48
  gr.Interface(asr_transcript,
 
24
  speech = librosa.resample(speech, sample_rate,16000)
25
  return speech
26
 
27
+ # def correct_casing(input_sentence):
28
 
29
+ # sentences = nltk.sent_tokenize(input_sentence)
30
+ # return (' '.join([s.replace(s[0],s[0].capitalize(),1) for s in sentences]))
31
 
32
  def asr_transcript(input_file):
33
 
 
40
  #Take argmax
41
  predicted_ids = torch.argmax(logits, dim=-1)
42
  #Get the words from predicted word ids
43
+ transcription = processor.batch_decode(predicted_ids[0])
44
  #Correcting the letter casing
45
+ #transcription = correct_casing(transcription.lower())
46
  return transcription
47
 
48
  gr.Interface(asr_transcript,