Mohammedallyl commited on
Commit
2a6e246
·
verified ·
1 Parent(s): a0c7be6

Update Logic/SpeachToText.py

Browse files
Files changed (1) hide show
  1. 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
- audio = AudioSegment.from_file(audio_file, format=file.filename.split('.')[-1])
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(wav_audio) as source:
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