Spaces:
Running
Running
vineelpratap
commited on
Commit
•
d3faf34
1
Parent(s):
ed7e000
Update asr.py
Browse files
asr.py
CHANGED
@@ -66,8 +66,11 @@ model = Wav2Vec2ForCTC.from_pretrained(MODEL_ID)
|
|
66 |
# )
|
67 |
|
68 |
|
69 |
-
def transcribe(audio_data, lang="eng (English)"):
|
70 |
|
|
|
|
|
|
|
71 |
if isinstance(audio_data, tuple):
|
72 |
# microphone
|
73 |
sr, audio_samples = audio_data
|
@@ -78,6 +81,7 @@ def transcribe(audio_data, lang="eng (English)"):
|
|
78 |
)
|
79 |
else:
|
80 |
# file upload
|
|
|
81 |
isinstance(audio_data, str)
|
82 |
audio_samples = librosa.load(audio_data, sr=ASR_SAMPLING_RATE, mono=True)[0]
|
83 |
|
|
|
66 |
# )
|
67 |
|
68 |
|
69 |
+
def transcribe(audio_data=None, lang="eng (English)"):
|
70 |
|
71 |
+
if not audio_data:
|
72 |
+
return "<<ERROR: Empty Audio Input>>"
|
73 |
+
|
74 |
if isinstance(audio_data, tuple):
|
75 |
# microphone
|
76 |
sr, audio_samples = audio_data
|
|
|
81 |
)
|
82 |
else:
|
83 |
# file upload
|
84 |
+
|
85 |
isinstance(audio_data, str)
|
86 |
audio_samples = librosa.load(audio_data, sr=ASR_SAMPLING_RATE, mono=True)[0]
|
87 |
|