The following code contains tools to get from video or audio to text and key takeaways for developers. Can be applied to video, audio or text, so can be used from meeting recordings, video demos, etc.
The following code is also meant to be a demo of the dol tools Pipe and written_key as well as the oa.prompt_function tool.
Requires dol, oa, speech_recognition and moviepy to be installed, though the last two are contained in functions and could be replaced.
from operator import attrgetter
from dol import Pipe, written_key
from oa import prompt_function
def video_to_audio(video_file_path):
from import moviepy.editor import VideoFileClip
return VideoFileClip(video_file_path)
def audio_file_to_text(audio_file_path):
import speech_recognition as sr
recognizer = sr.Recognizer()
with sr.AudioFile(audio_file_path) as source:
audio_data = recognizer.record(source)
text = recognizer.recognize_google(audio_data)
return text
audio_obj_writer = lambda audio, path: audio.write_audiofile(path)
save_audio_to_wav_file = written_key(writer=audio_obj_writer, key='*.wav')
video_to_text = Pipe(
video_to_audio, attrgetter('audio'), save_audio_to_wav_file, audio_file_to_text
)
text_to_dev_takeaways = prompt_function(
"""
From the following transcription, I'd like you to extract
the tasks that would be relevant to developers.
These tasks should be actionable. They might be bugs to repair or features to add or enhance.
I will be copy pasting these as issues in a github repo, so please include a
short title and a description for each task, as a bullet point list
where the title is bolded and the description comes after the colon. Like this:
- **Title 1**: Description of the task 1
- **Title 2**: Description of the task 2
Here's my transcription:
{text}
"""
)
audio_to_dev_takeaways = Pipe(audio_file_to_text, text_to_dev_takeaways)
video_to_dev_takeaways = Pipe(video_to_text, text_to_dev_takeaways)
Examples