Skip to content

Commit

Permalink
only delete audio file when it gets created
Browse files Browse the repository at this point in the history
  • Loading branch information
emcf committed Apr 30, 2024
1 parent c10d08f commit edf4f5e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion thepipe_api/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,12 @@ def extract_video(file_path: str, verbose: bool = False, text_only: bool = False
audio.write_audiofile(audio_path, codec='pcm_s16le')
result = model.transcribe(audio_path, verbose=verbose)
transcription = result['text']
os.remove(audio_path)
# add chunk
if not text_only:
chunks.append(Chunk(path=file_path, text=transcription, image=image, source_type=SourceTypes.VIDEO))
else:
chunks.append(Chunk(path=file_path, text=transcription, image=None, source_type=SourceTypes.VIDEO))
os.remove(audio_path)
return chunks

def extract_youtube(youtube_url: str, text_only: bool = False, verbose: bool = False) -> List[Chunk]:
Expand Down

0 comments on commit edf4f5e

Please sign in to comment.