RamAnanth1 commited on
Commit
051c974
·
1 Parent(s): f5c44a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -22,25 +22,25 @@ def transcribe(audio):
22
 
23
  """)
24
 
25
- audio = whisper.load_audio(audio)
26
- audio = whisper.pad_or_trim(audio)
27
 
28
- mel = whisper.log_mel_spectrogram(audio).to(whisper_model.device)
29
 
30
- _, probs = whisper_model.detect_language(mel)
31
 
32
- transcript_options = whisper.DecodingOptions(task="transcribe", fp16 = False)
33
- translate_options = whisper.DecodingOptions(task="translate", fp16 = False)
34
 
35
- transcription = whisper.decode(whisper_model, mel, transcript_options)
36
- translation = whisper.decode(whisper_model, mel, translate_options)
37
-
38
- print("Language Spoken: " + transcription.language)
39
- print("Transcript: " + transcription.text)
40
- print("Translated: " + translation.text)
41
 
42
 
43
- return transcription.text
44
 
45
  def transcribe_upload(audio):
46
  return transcribe(audio)
 
22
 
23
  """)
24
 
25
+ #audio = whisper.load_audio(audio)
26
+ #audio = whisper.pad_or_trim(audio)
27
 
28
+ #mel = whisper.log_mel_spectrogram(audio).to(whisper_model.device)
29
 
30
+ #_, probs = whisper_model.detect_language(mel)
31
 
32
+ #transcript_options = whisper.DecodingOptions(task="transcribe", fp16 = False)
33
+ #translate_options = whisper.DecodingOptions(task="translate", fp16 = False)
34
 
35
+ #transcription = whisper.decode(whisper_model, mel, transcript_options)
36
+ #translation = whisper.decode(whisper_model, mel, translate_options)
37
+ result = whisper_model.transcribe(audio)
38
+ #print("Language Spoken: " + transcription.language)
39
+ #print("Transcript: " + transcription.text)
40
+ #print("Translated: " + translation.text)
41
 
42
 
43
+ return result["text"]
44
 
45
  def transcribe_upload(audio):
46
  return transcribe(audio)