Spaces:
Runtime error
Runtime error
Samarth991
commited on
Commit
•
3dc3903
1
Parent(s):
5cc939d
adding whisper feature for duration
Browse files- whisper_app.py +3 -3
whisper_app.py
CHANGED
@@ -39,7 +39,7 @@ class WHISPERModel:
|
|
39 |
else:
|
40 |
raise("Unable to reach for URL {}".format(audio_path))
|
41 |
else:
|
42 |
-
self.read_audio(audio_path)
|
43 |
if audio :
|
44 |
conv_language = self.get_info(audio)
|
45 |
if conv_language !='en':
|
@@ -50,8 +50,8 @@ class WHISPERModel:
|
|
50 |
res = self.model.transcribe(audio)
|
51 |
audio_duration = audio.shape[0] / SAMPLE_RATE
|
52 |
text_data['text'] = res['text']
|
53 |
-
|
54 |
-
|
55 |
return text_data
|
56 |
|
57 |
|
|
|
39 |
else:
|
40 |
raise("Unable to reach for URL {}".format(audio_path))
|
41 |
else:
|
42 |
+
audio = self.read_audio(audio_path)
|
43 |
if audio :
|
44 |
conv_language = self.get_info(audio)
|
45 |
if conv_language !='en':
|
|
|
50 |
res = self.model.transcribe(audio)
|
51 |
audio_duration = audio.shape[0] / SAMPLE_RATE
|
52 |
text_data['text'] = res['text']
|
53 |
+
text_data['duration'] = audio_duration
|
54 |
+
text_data['language'] = conv_language
|
55 |
return text_data
|
56 |
|
57 |
|