Spaces:
Runtime error
Runtime error
SLAYEROFALL3050
commited on
Commit
•
0711ae3
1
Parent(s):
37e908b
Update condensedmodel.py
Browse files
AudioToText/condensedmodel.py
CHANGED
@@ -135,26 +135,7 @@ def loadWeights():
|
|
135 |
|
136 |
# Load CKPT to Model
|
137 |
model.load_weights(output)
|
138 |
-
|
139 |
-
def convertAudioToWav(audio_file):
|
140 |
-
ext = os.path.splitext(audio_file)[-1].lower()
|
141 |
-
|
142 |
-
audio_to_return = 'audio_as.wav'
|
143 |
-
|
144 |
-
# Now we can simply use == to check for equality, no need for wildcards.
|
145 |
-
if ext == ".mp3":
|
146 |
-
subprocess.call(['ffmpeg', '-i', audio_file, audio_to_return])
|
147 |
-
elif ext == ".flac":
|
148 |
-
subprocess.call(['ffmpeg', '-i', audio_file, audio_to_return])
|
149 |
-
elif ext == ".m4a":
|
150 |
-
subprocess.call(['ffmpeg', '-i', audio_file, audio_to_return])
|
151 |
-
elif ext == ".wma":
|
152 |
-
subprocess.call(['ffmpeg', '-i', audio_file, audio_to_return])
|
153 |
-
elif ext == ".aac":
|
154 |
-
subprocess.call(['ffmpeg', '-i', audio_file, audio_to_return])
|
155 |
-
|
156 |
-
return audio_to_return
|
157 |
-
|
158 |
def load_wav(filename):
|
159 |
wav,_ = librosa.load(convertAudioToWav(filename), sr = 22050)
|
160 |
|
@@ -224,7 +205,7 @@ def AudioToTextUsingModel(wav_file):
|
|
224 |
return output_text
|
225 |
|
226 |
def AudioToTextUsingAPI(audio_file):
|
227 |
-
AUDIO_FILE =
|
228 |
|
229 |
# use the audio file as the audio source
|
230 |
|
|
|
135 |
|
136 |
# Load CKPT to Model
|
137 |
model.load_weights(output)
|
138 |
+
s
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
def load_wav(filename):
|
140 |
wav,_ = librosa.load(convertAudioToWav(filename), sr = 22050)
|
141 |
|
|
|
205 |
return output_text
|
206 |
|
207 |
def AudioToTextUsingAPI(audio_file):
|
208 |
+
AUDIO_FILE = load_wav(audio_file)
|
209 |
|
210 |
# use the audio file as the audio source
|
211 |
|