Spaces:
Sleeping
Sleeping
Update Logic/SpeachToText.py
Browse files- Logic/SpeachToText.py +2 -5
Logic/SpeachToText.py
CHANGED
|
@@ -22,14 +22,11 @@ async def transcribe_audio(file: UploadFile = File(...)):
|
|
| 22 |
audio_file = BytesIO(audio_data)
|
| 23 |
|
| 24 |
# Use pydub to handle different audio formats
|
| 25 |
-
|
| 26 |
-
wav_audio = BytesIO()
|
| 27 |
-
audio.export(wav_audio, format="wav")
|
| 28 |
-
wav_audio.seek(0)
|
| 29 |
|
| 30 |
# Use speech_recognition to process the audio
|
| 31 |
recognizer = sr.Recognizer()
|
| 32 |
-
with sr.AudioFile(
|
| 33 |
audio = recognizer.record(source)
|
| 34 |
|
| 35 |
# Recognize speech using Google Web Speech API
|
|
|
|
| 22 |
audio_file = BytesIO(audio_data)
|
| 23 |
|
| 24 |
# Use pydub to handle different audio formats
|
| 25 |
+
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
# Use speech_recognition to process the audio
|
| 28 |
recognizer = sr.Recognizer()
|
| 29 |
+
with sr.AudioFile(audio_file) as source:
|
| 30 |
audio = recognizer.record(source)
|
| 31 |
|
| 32 |
# Recognize speech using Google Web Speech API
|