ashhadahsan commited on
Commit
a526070
1 Parent(s): 149aab0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -9,6 +9,7 @@ from utils import (
9
  read,
10
  get_key,
11
  )
 
12
  import whisperx as whisper
13
  import json
14
  import pandas as pd
@@ -165,15 +166,19 @@ with output:
165
  temp = AudioSegment.from_wav(audio_uploaded)
166
  temp.export(f"{name}.wav")
167
  if audio_uploaded.name.endswith(".mp3"):
168
- try:
 
 
 
 
169
 
170
- temp = AudioSegment.from_file(audio_uploaded, format="mp3")
171
- temp.export(f"{name}.wav")
172
- except:
173
 
174
 
175
- temp = AudioSegment.from_file(audio_uploaded, format="mp4")
176
- temp.export(f"{name}.wav")
177
  if language == "":
178
  model = whisper.load_model(model_name)
179
  with st.spinner("Detecting language..."):
 
9
  read,
10
  get_key,
11
  )
12
+ import subprocess
13
  import whisperx as whisper
14
  import json
15
  import pandas as pd
 
166
  temp = AudioSegment.from_wav(audio_uploaded)
167
  temp.export(f"{name}.wav")
168
  if audio_uploaded.name.endswith(".mp3"):
169
+
170
+
171
+ subprocess.call(['ffmpeg', '-i', audio_uploaded.name,
172
+ f'{name}.wav'])
173
+ # try:
174
 
175
+ # temp = AudioSegment.from_file(audio_uploaded, format="mp3")
176
+ # temp.export(f"{name}.wav")
177
+ # except:
178
 
179
 
180
+ # temp = AudioSegment.from_file(audio_uploaded, format="mp4")
181
+ # temp.export(f"{name}.wav")
182
  if language == "":
183
  model = whisper.load_model(model_name)
184
  with st.spinner("Detecting language..."):