Update functions.py
Browse files- functions.py +4 -4
functions.py
CHANGED
@@ -152,7 +152,7 @@ def load_whisper_api(audio):
|
|
152 |
|
153 |
'''Transcribe YT audio to text using Open AI API'''
|
154 |
file = open(audio, "rb")
|
155 |
-
transcript = openai_audio.audio.transcriptions.create(model="whisper-1", file=file)
|
156 |
|
157 |
return transcript
|
158 |
|
@@ -179,7 +179,7 @@ def transcribe_yt_video(link, py_tube=True):
|
|
179 |
st.info("`Transcribing YT audio...`")
|
180 |
|
181 |
#Use whisper API
|
182 |
-
results = load_whisper_api(st.session_state['audio'])
|
183 |
|
184 |
else:
|
185 |
|
@@ -200,7 +200,7 @@ def transcribe_yt_video(link, py_tube=True):
|
|
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}.mp3')
|
204 |
|
205 |
results = ','.join(transcriptions)
|
206 |
|
@@ -244,7 +244,7 @@ def transcribe_yt_video(link, py_tube=True):
|
|
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}.
|
248 |
|
249 |
results = ','.join(transcriptions)
|
250 |
|
|
|
152 |
|
153 |
'''Transcribe YT audio to text using Open AI API'''
|
154 |
file = open(audio, "rb")
|
155 |
+
transcript = openai_audio.audio.transcriptions.create(model="whisper-1", file=file,response_format="text")
|
156 |
|
157 |
return transcript
|
158 |
|
|
|
179 |
st.info("`Transcribing YT audio...`")
|
180 |
|
181 |
#Use whisper API
|
182 |
+
results = load_whisper_api(st.session_state['audio'])
|
183 |
|
184 |
else:
|
185 |
|
|
|
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}.mp3'))
|
204 |
|
205 |
results = ','.join(transcriptions)
|
206 |
|
|
|
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}.mp3')
|
248 |
|
249 |
results = ','.join(transcriptions)
|
250 |
|