Kleber commited on
Commit
52c6777
1 Parent(s): 681b48e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -15,7 +15,11 @@ def transcribe(file):
15
 
16
  #print("filename: ",file)
17
  try:
18
- audio = AudioSegment.from_file(file).set_frame_rate(16000).set_channels(1)
 
 
 
 
19
  new_file_name = file.split(".")[0]+".wav"
20
  audio.export(new_file_name,format)
21
  except Exception as e:
 
15
 
16
  #print("filename: ",file)
17
  try:
18
+ audio = AudioSegment.from_file(file)
19
+ if audio.frame_rate != 16000:
20
+ audio = audio.set_frame_rate(16000)
21
+ if audio.channels != 1:
22
+ audio = audio.set_channels(1)
23
  new_file_name = file.split(".")[0]+".wav"
24
  audio.export(new_file_name,format)
25
  except Exception as e: