Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,19 +1,15 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import speech_recognition as sr
|
| 3 |
|
| 4 |
-
def transcribe_audio(
|
| 5 |
recognizer = sr.Recognizer()
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
if isinstance(
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
# Ensure the audio_file is a file path
|
| 12 |
-
if not isinstance(audio_file, str):
|
| 13 |
-
raise ValueError("Expected audio_file to be a file path, got {}".format(type(audio_file)))
|
| 14 |
|
| 15 |
# Load the audio file
|
| 16 |
-
with sr.AudioFile(
|
| 17 |
audio_data = recognizer.record(source)
|
| 18 |
|
| 19 |
try:
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import speech_recognition as sr
|
| 3 |
|
| 4 |
+
def transcribe_audio(audio_file_path):
|
| 5 |
recognizer = sr.Recognizer()
|
| 6 |
|
| 7 |
+
# Ensure the audio_file_path is a file path
|
| 8 |
+
if not isinstance(audio_file_path, str):
|
| 9 |
+
raise ValueError("Expected audio_file_path to be a file path, got {}".format(type(audio_file_path)))
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# Load the audio file
|
| 12 |
+
with sr.AudioFile(audio_file_path) as source:
|
| 13 |
audio_data = recognizer.record(source)
|
| 14 |
|
| 15 |
try:
|