Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
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:
|