nickmuchi commited on
Commit
397dade
1 Parent(s): d9cd768

Update functions.py

Browse files
Files changed (1) hide show
  1. functions.py +6 -6
functions.py CHANGED
@@ -113,7 +113,7 @@ def get_yt_audio(url):
113
  title = yt.title
114
 
115
  # Get the first available audio stream and download it
116
- audio_stream = yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first().download()
117
 
118
  return audio_stream, title
119
 
@@ -185,7 +185,7 @@ def transcribe_yt_video(link, py_tube=True):
185
 
186
  st.warning('File size larger than 24mb, applying chunking and transcription',icon="⚠️")
187
 
188
- song = AudioSegment.from_file(st.session_state['audio'], format='mp4')
189
 
190
  # PyDub handles time in milliseconds
191
  twenty_minutes = 20 * 60 * 1000
@@ -199,8 +199,8 @@ def transcribe_yt_video(link, py_tube=True):
199
  print(video_id)
200
 
201
  for i, chunk in enumerate(chunks):
202
- chunk.export(f'output/chunk_{i}_{video_id}.mp4', format='mp4')
203
- transcriptions.append(load_whisper_api(f'output/chunk_{i}_{video_id}.mp4'))
204
 
205
  results = ','.join(transcriptions)
206
 
@@ -231,7 +231,7 @@ def transcribe_yt_video(link, py_tube=True):
231
 
232
  st.warning('File size larger than 24mb, applying chunking and transcription',icon="⚠️")
233
 
234
- song = AudioSegment.from_file(st.session_state['audio'], format='mp4')
235
 
236
  # PyDub handles time in milliseconds
237
  twenty_minutes = 20 * 60 * 1000
@@ -243,7 +243,7 @@ def transcribe_yt_video(link, py_tube=True):
243
  video_id = extract.video_id(link)
244
 
245
  for i, chunk in enumerate(chunks):
246
- chunk.export(f'output/chunk_{i}_{video_id}.mp3', format='mp4')
247
  transcriptions.append(load_whisper_api(f'output/chunk_{i}_{video_id}.mp4')['text'])
248
 
249
  results = ','.join(transcriptions)
 
113
  title = yt.title
114
 
115
  # Get the first available audio stream and download it
116
+ audio_stream = yt.streams.filter(progressive=True, file_extension='mp3').order_by('resolution').desc().first().download()
117
 
118
  return audio_stream, title
119
 
 
185
 
186
  st.warning('File size larger than 24mb, applying chunking and transcription',icon="⚠️")
187
 
188
+ song = AudioSegment.from_file(st.session_state['audio'], format='mp3')
189
 
190
  # PyDub handles time in milliseconds
191
  twenty_minutes = 20 * 60 * 1000
 
199
  print(video_id)
200
 
201
  for i, chunk in enumerate(chunks):
202
+ chunk.export(f'output/chunk_{i}_{video_id}.mp4', format='mp3')
203
+ transcriptions.append(load_whisper_api(f'output/chunk_{i}_{video_id}.mp4')['text'])
204
 
205
  results = ','.join(transcriptions)
206
 
 
231
 
232
  st.warning('File size larger than 24mb, applying chunking and transcription',icon="⚠️")
233
 
234
+ song = AudioSegment.from_file(st.session_state['audio'], format='mp3')
235
 
236
  # PyDub handles time in milliseconds
237
  twenty_minutes = 20 * 60 * 1000
 
243
  video_id = extract.video_id(link)
244
 
245
  for i, chunk in enumerate(chunks):
246
+ chunk.export(f'output/chunk_{i}_{video_id}.mp3', format='mp3')
247
  transcriptions.append(load_whisper_api(f'output/chunk_{i}_{video_id}.mp4')['text'])
248
 
249
  results = ','.join(transcriptions)