Antoniskaraolis commited on
Commit
428f475
·
1 Parent(s): 434fda4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -1,9 +1,11 @@
1
  import gradio as gr
2
- from speech_recognition import Recognizer, AudioFile
3
 
4
- def transcribe_audio(file):
5
- recognizer = Recognizer()
6
- with AudioFile(file) as source:
 
 
7
  audio_data = recognizer.record(source)
8
  try:
9
  text = recognizer.recognize_google(audio_data)
 
1
  import gradio as gr
2
+ import speech_recognition as sr # Importing the speech_recognition module
3
 
4
+ def transcribe_audio(file_info):
5
+ recognizer = sr.Recognizer()
6
+ audio_file = file_info['content']
7
+
8
+ with sr.AudioFile(audio_file) as source:
9
  audio_data = recognizer.record(source)
10
  try:
11
  text = recognizer.recognize_google(audio_data)