Vihang28 commited on
Commit
1f38dc2
1 Parent(s): c52635d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -18,14 +18,11 @@ def record_text(audio_file,prompt):
18
  if sound_type[-1] == 'mp3':
19
  input_file = sound
20
  output_file = "con_sound.wav"
21
- try:
22
- # convert mp3 file to wav file
23
- sound = AudioSegment.from_mp3(input_file)
24
- sound.export(output_file, format="wav")
25
- sound = "con_sound.wav"
26
- except Exception as e:
27
- print(f"Error converting MP3 to WAV: {e}")
28
- return ""
29
 
30
  MyText = ""
31
  with sr.AudioFile(sound) as source:
 
18
  if sound_type[-1] == 'mp3':
19
  input_file = sound
20
  output_file = "con_sound.wav"
21
+
22
+ # convert mp3 file to wav file
23
+ sound = AudioSegment.from_mp3(input_file)
24
+ sound.export(output_file, format="wav")
25
+ sound = "con_sound.wav"
 
 
 
26
 
27
  MyText = ""
28
  with sr.AudioFile(sound) as source: